diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 73a506f..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/base/unary) 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 6926533..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/base/unary) 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 4bf6cb5..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: '42 18 * * 6' - - # 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 + + ```
@@ -194,13336 +185,7 @@ console.log( ndarray2array( y.data, y.shape, y.strides, y.offset, y.order ) ); -* * * - -
- -## C APIs - - - -
- -Character codes for data types: - - - - - -- **x**: `bool` (boolean). -- **c**: `complex64` (single-precision floating-point complex number). -- **z**: `complex128` (double-precision floating-point complex number). -- **f**: `float32` (single-precision floating-point number). -- **d**: `float64` (double-precision floating-point number). -- **k**: `int16` (signed 16-bit integer). -- **i**: `int32` (signed 32-bit integer). -- **s**: `int8` (signed 8-bit integer). -- **t**: `uint16` (unsigned 16-bit integer). -- **u**: `uint32` (unsigned 32-bit integer). -- **b**: `uint8` (unsigned 8-bit integer). - - - -Function name suffix naming convention: - -```text -stdlib_ndarray__[_as__] -``` - -For example, - - - -```c -void stdlib_ndarray_d_d(...) {...} -``` - -is a function which accepts one double-precision floating-point input ndarray and one double-precision floating-point output ndarray. In other words, the suffix encodes the function type signature. - -To support callbacks whose input arguments and/or return values are of a different data type than the input and/or output ndarray data types, the naming convention supports appending an `as` suffix. For example, - - - -```c -void stdlib_ndarray_f_f_as_d_d(...) {...} -``` - -is a function which accepts one single-precision floating-point input ndarray and one single-precision floating-point output ndarray. However, the callback accepts and returns double-precision floating-point numbers. Accordingly, the input and output values need to be cast using the following conversion sequence - -```c -// Convert each input array element to double-precision: -double in1 = (double)x[ i ]; - -// Evaluate the callback: -double out = f( in1 ); - -// Convert the callback return value to single-precision: -y[ i ] = (float)out; -``` - -When the input ndarray and the callback (i.e., the input argument and return value) share the same data type, the `as` suffix can be omitted. For example, - - - -```c -void stdlib_ndarray_f_d(...) {...} -``` - -is a function which accepts one single-precision floating-point input ndarray and one double-precision floating-point output ndarray. The callback is assumed to accept and return single-precision floating-point numbers. Accordingly, the input and output values are cast according to the following conversion sequence - - - -```c -// Retrieve each input array element as single-precision: -float in1 = (float)x[ i ]; - -// Evaluate the callback: -float out = f( in1 ); - -// Convert the callback return value to double-precision: -y[ i ] = (double)out; -``` - -
- - - - - -
- -### Usage - -```c -#include "stdlib/ndarray/base/unary.h" -``` - - - - - -#### stdlib_ndarray_b_b( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 2, 1 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_b( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_b( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_b_as_u_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 2, 1 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_b_as_u_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_b_as_u_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_c_as_b_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_c_as_b_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_c_as_b_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_c_as_c_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_c_as_c_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_c_as_c_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_c_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_c_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_c_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_d_as_b_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_d_as_b_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_d_as_b_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_f_as_b_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_f_as_b_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_f_as_b_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_f_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_f_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_f_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_f_as_f_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_f_as_f_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_f_as_f_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_i_as_b_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_i_as_b_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_i_as_b_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_i_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_i_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_i_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_k_as_b_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_k_as_b_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_k_as_b_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_k_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_k_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_k_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_k_as_k_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_k_as_k_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_k_as_k_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_t( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_t( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_t( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_t_as_b_t( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_t_as_b_t( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_t_as_b_t( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_t_as_t_t( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_t_as_t_t( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_t_as_t_t( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_t_as_u_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_t_as_u_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_t_as_u_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_u_as_b_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_u_as_b_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_u_as_b_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_u_as_u_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_u_as_u_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_u_as_u_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint8_t fcn( const uint8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint8_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_z_as_b_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const uint8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_z_as_b_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(uint8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_z_as_b_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_b_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_b_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_b_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_c_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_c_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_c_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_c_c_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_c_c_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_c_c_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_c_f_as_c_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_c_f_as_c_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_c_f_as_c_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_c_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_c_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_c_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_c_z_as_c_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_c_z_as_c_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_c_z_as_c_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_c_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_c_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_c_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_d_i_as_d_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const double x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_d_i_as_d_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_d_i_as_d_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_d_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_d_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_d_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_d_z_as_d_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const double x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_d_z_as_d_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_d_z_as_d_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_d_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 16, 8 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_d_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_d_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_c_as_c_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_c_as_c_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_c_as_c_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_c_as_f_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const float x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_c_as_f_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_c_as_f_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_c_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_c_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_c_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_d_as_f_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const float x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_d_as_f_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_d_as_f_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_f_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_f_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_f_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_i_as_f_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const float x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_i_as_f_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_i_as_f_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_z_as_f_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const float x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_z_as_f_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_z_as_f_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_f_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_f_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_f_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_d_as_i_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const int32_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_d_as_i_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_d_as_i_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_z_as_i_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const int32_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_z_as_i_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_z_as_i_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_i_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_i_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_i_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_c_as_c_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_c_as_c_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_c_as_c_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_c_as_k_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const int16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_c_as_k_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_c_as_k_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_c_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_c_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_c_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_d_as_k_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const int16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_d_as_k_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_d_as_k_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_f_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_f_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_f_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_f_as_f_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_f_as_f_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_f_as_f_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_f_as_k_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const int16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_f_as_k_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_f_as_k_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_i_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_i_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_i_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_i_as_k_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_i_as_k_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_i_as_k_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_k_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_k_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_k_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_t( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_t( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_t( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_t_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_t_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_t_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_u_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_u_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_u_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_z_as_k_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const int16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_z_as_k_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_z_as_k_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_k_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_k_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_k_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_b( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 2, 1 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_b( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_b( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_c_as_c_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_c_as_c_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_c_as_c_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_c_as_s_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const int8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_c_as_s_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_c_as_s_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_c_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_c_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_c_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_d_as_s_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const int8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_d_as_s_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_d_as_s_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_f_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_f_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_f_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_f_as_f_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_f_as_f_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_f_as_f_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_f_as_s_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const int8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_f_as_s_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_f_as_s_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_i_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_i_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_i_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_i_as_s_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_i_as_s_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_i_as_s_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_k_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_k_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_k_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_k_as_k_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_k_as_k_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_k_as_k_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_k_as_s_k( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int16_t fcn( const int8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_k_as_s_k( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int16_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_k_as_s_k( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_s( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 2, 1 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_s( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_s( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_s_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 2, 1 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_s_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_s_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_t( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_t( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_t( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_t_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_t_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_t_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_u_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_u_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_u_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int8_t fcn( const int8_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int8_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_z_as_s_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const int8_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_z_as_s_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(int8_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_z_as_s_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_s_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_s_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_s_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_c_as_c_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_c_as_c_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(stdlib_complex64_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_c_as_c_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_c_as_t_c( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex64_t fcn( const uint16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_c_as_t_c( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex64_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_c_as_t_c( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_c_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_c_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_c_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_d_as_t_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const uint16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_d_as_t_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_d_as_t_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_f_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_f_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_f_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_f_as_f_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const float x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_f_as_f_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(float)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_f_as_f_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_f_as_t_f( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static float fcn( const uint16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_f_as_t_f( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `float (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_f_as_t_f( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_i_as_i_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const int32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_i_as_i_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(int32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_i_as_i_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_i_as_t_i( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static int32_t fcn( const uint16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_i_as_t_i( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `int32_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_i_as_t_i( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_t( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_t( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_t( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_t_as_u_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 4, 2 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_t_as_u_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_t_as_u_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_u_as_t_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_u_as_t_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_u_as_t_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_u_as_u_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_u_as_u_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_u_as_u_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint16_t fcn( const uint16_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint16_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_z_as_t_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const uint16_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_z_as_t_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(uint16_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_z_as_t_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_t_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 4, 2 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_t_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_t_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_d_as_d_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const double x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_d_as_d_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(double)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_d_as_d_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_d_as_u_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const uint32_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_d_as_u_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_d_as_u_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_u( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 8, 4 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_u( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_u( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static uint32_t fcn( const uint32_t x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `uint32_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_z_as_u_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const uint32_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_z_as_u_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(uint32_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_z_as_u_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_u_z_as_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 8, 4 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_u_z_as_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_u_z_as_z_z( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_x_x( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 0, 0, 0, 0 }; -uint8_t ybuf[] = { 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 2, 1 }; -int64_t sy[] = { 2, 1 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static bool fcn( const bool x ) { - return x; -} - -// Apply the callback: -int8_t status = stdlib_ndarray_x_x( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `bool (*f)(bool)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_x_x( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_z_d_as_z_d( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 32, 16 }; -int64_t sy[] = { 16, 8 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static double fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_z_d_as_z_d( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `double (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_z_d_as_z_d( struct ndarray *arrays[], void *fcn ); -``` - -#### stdlib_ndarray_z_z( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - -// Create underlying byte arrays: -uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { 2, 2 }; - -// Define the strides: -int64_t sx[] = { 32, 16 }; -int64_t sy[] = { 32, 16 }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { - // ... -} - -// Apply the callback: -int8_t status = stdlib_ndarray_z_z( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `stdlib_complex128_t (*f)(stdlib_complex128_t)` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_z_z( struct ndarray *arrays[], void *fcn ); -``` - - - - - - - - - -
- - - - - -
- -
- - - - - -* * * - -
- -### Examples - -```c -#include "stdlib/ndarray/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int64_t i; - int8_t s; - double v; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_float64( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %lf\n", i, v ); - } -} - -static double scale( const double x ) { - return x + 10.0; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_FLOAT64; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 32, 16, 8 }; - int64_t sy[] = { 32, 16, 8 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_d_d( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} -``` - -
- - - -
- @@ -13546,7 +208,7 @@ int main( void ) { ## Notice -This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. +This package is part of [stdlib][stdlib], a standard library with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. @@ -13611,7 +273,7 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/dispatch]: https://github.com/stdlib-js/ndarray-dispatch +[@stdlib/ndarray/dispatch]: https://github.com/stdlib-js/ndarray-dispatch/tree/esm diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4c..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security - -> Policy for reporting security vulnerabilities. - -See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security). diff --git a/benchmark/benchmark.10d_blocked_columnmajor.js b/benchmark/benchmark.10d_blocked_columnmajor.js deleted file mode 100644 index d8a737d..0000000 --- a/benchmark/benchmark.10d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/10d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.10d_blocked_rowmajor.js b/benchmark/benchmark.10d_blocked_rowmajor.js deleted file mode 100644 index c2ed587..0000000 --- a/benchmark/benchmark.10d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/10d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.10d_columnmajor.js b/benchmark/benchmark.10d_columnmajor.js deleted file mode 100644 index fc31af4..0000000 --- a/benchmark/benchmark.10d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/10d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.10d_rowmajor.js b/benchmark/benchmark.10d_rowmajor.js deleted file mode 100644 index a4c232f..0000000 --- a/benchmark/benchmark.10d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/10d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/10.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 9 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.11d_columnmajor.js b/benchmark/benchmark.11d_columnmajor.js deleted file mode 100644 index cf453cb..0000000 --- a/benchmark/benchmark.11d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/nd.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/11.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 10 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.11d_rowmajor.js b/benchmark/benchmark.11d_rowmajor.js deleted file mode 100644 index a07e09e..0000000 --- a/benchmark/benchmark.11d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/nd.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/11.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 10 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.1d_columnmajor.js b/benchmark/benchmark.1d_columnmajor.js deleted file mode 100644 index 86f561d..0000000 --- a/benchmark/benchmark.1d_columnmajor.js +++ /dev/null @@ -1,141 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( [ x, y ], identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.1d_rowmajor.js b/benchmark/benchmark.1d_rowmajor.js deleted file mode 100644 index 5d155fa..0000000 --- a/benchmark/benchmark.1d_rowmajor.js +++ /dev/null @@ -1,141 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( [ x, y ], identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.2d_blocked_columnmajor.js b/benchmark/benchmark.2d_blocked_columnmajor.js deleted file mode 100644 index 46988d4..0000000 --- a/benchmark/benchmark.2d_blocked_columnmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/2d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.2d_blocked_rowmajor.js b/benchmark/benchmark.2d_blocked_rowmajor.js deleted file mode 100644 index 4c022ce..0000000 --- a/benchmark/benchmark.2d_blocked_rowmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/2d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.2d_columnmajor.js b/benchmark/benchmark.2d_columnmajor.js deleted file mode 100644 index 63d3f93..0000000 --- a/benchmark/benchmark.2d_columnmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/2d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.2d_rowmajor.js b/benchmark/benchmark.2d_rowmajor.js deleted file mode 100644 index 08440d3..0000000 --- a/benchmark/benchmark.2d_rowmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/2d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.2d_rowmajor_accessors.js b/benchmark/benchmark.2d_rowmajor_accessors.js deleted file mode 100644 index 1e89dd2..0000000 --- a/benchmark/benchmark.2d_rowmajor_accessors.js +++ /dev/null @@ -1,181 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/2d_accessors.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Returns an array data buffer element. -* -* @private -* @param {Collection} buf - data buffer -* @param {NonNegativeInteger} idx - element index -* @returns {*} element -*/ -function get( buf, idx ) { - return buf[ idx ]; -} - -/** -* Sets an array data buffer element. -* -* @private -* @param {Collection} buf - data buffer -* @param {NonNegativeInteger} idx - element index -* @param {*} value - value to set -*/ -function set( buf, idx, value ) { - buf[ idx ] = value; -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order, - 'accessorProtocol': true, - 'accessors': [ get, set ] - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order, - 'accessorProtocol': true, - 'accessors': [ get, set ] - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.2d_rowmajor_accessors_complex.js b/benchmark/benchmark.2d_rowmajor_accessors_complex.js deleted file mode 100644 index 4b1794a..0000000 --- a/benchmark/benchmark.2d_rowmajor_accessors_complex.js +++ /dev/null @@ -1,188 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var sqrt = require( '@stdlib/math-base-special-sqrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/2d_accessors.js' ); - - -// VARIABLES // - -var types = [ 'complex64' ]; -var order = 'row-major'; -var abtype = { - 'complex64': 'float32', - 'complex128': 'float64' -}; - - -// FUNCTIONS // - -/** -* Returns an array data buffer element. -* -* @private -* @param {Collection} buf - data buffer -* @param {NonNegativeInteger} idx - element index -* @returns {*} element -*/ -function get( buf, idx ) { - return buf.get( idx ); -} - -/** -* Sets an array data buffer element. -* -* @private -* @param {Collection} buf - data buffer -* @param {NonNegativeInteger} idx - element index -* @param {*} value - value to set -*/ -function set( buf, idx, value ) { - buf.set( value, idx ); -} - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var xbuf; - var ybuf; - var x; - var y; - var i; - - xbuf = filledarray( 0.0, len*2, abtype[ xtype ] ); - ybuf = filledarray( 0.0, len*2, abtype[ ytype ] ); - for ( i = 0; i < len*2; i++ ) { - xbuf[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': new ( ctors( xtype ) )( xbuf.buffer ), - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order, - 'accessorProtocol': true, - 'accessors': [ get, set ] - }; - y = { - 'dtype': ytype, - 'data': new ( ctors( ytype ) )( ybuf.buffer ), - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order, - 'accessorProtocol': true, - 'accessors': [ get, set ] - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( ybuf[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( ybuf[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 5; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( sqrt( len ) ); - sh = [ len, len ]; - len *= len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::accessors:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.3d_blocked_columnmajor.js b/benchmark/benchmark.3d_blocked_columnmajor.js deleted file mode 100644 index 8c43f62..0000000 --- a/benchmark/benchmark.3d_blocked_columnmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/3d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( cbrt( len ) ); - sh = [ len, len, len ]; - len *= len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.3d_blocked_rowmajor.js b/benchmark/benchmark.3d_blocked_rowmajor.js deleted file mode 100644 index 90ee624..0000000 --- a/benchmark/benchmark.3d_blocked_rowmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/3d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( cbrt( len ) ); - sh = [ len, len, len ]; - len *= len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.3d_columnmajor.js b/benchmark/benchmark.3d_columnmajor.js deleted file mode 100644 index 3348a12..0000000 --- a/benchmark/benchmark.3d_columnmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/3d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( cbrt( len ) ); - sh = [ len, len, len ]; - len *= len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.3d_rowmajor.js b/benchmark/benchmark.3d_rowmajor.js deleted file mode 100644 index 5c2ccbf..0000000 --- a/benchmark/benchmark.3d_rowmajor.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var cbrt = require( '@stdlib/math-base-special-cbrt' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/3d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( cbrt( len ) ); - sh = [ len, len, len ]; - len *= len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.4d_blocked_columnmajor.js b/benchmark/benchmark.4d_blocked_columnmajor.js deleted file mode 100644 index c6c210b..0000000 --- a/benchmark/benchmark.4d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/4d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.4d_blocked_rowmajor.js b/benchmark/benchmark.4d_blocked_rowmajor.js deleted file mode 100644 index a974950..0000000 --- a/benchmark/benchmark.4d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/4d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.4d_columnmajor.js b/benchmark/benchmark.4d_columnmajor.js deleted file mode 100644 index 8d2490e..0000000 --- a/benchmark/benchmark.4d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/4d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.4d_rowmajor.js b/benchmark/benchmark.4d_rowmajor.js deleted file mode 100644 index c5037b3..0000000 --- a/benchmark/benchmark.4d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/4d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/4.0 ) ); - sh = [ len, len, len, len ]; - len *= len * len * len; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.5d_blocked_columnmajor.js b/benchmark/benchmark.5d_blocked_columnmajor.js deleted file mode 100644 index 3e410fe..0000000 --- a/benchmark/benchmark.5d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/5d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.5d_blocked_rowmajor.js b/benchmark/benchmark.5d_blocked_rowmajor.js deleted file mode 100644 index 35fa993..0000000 --- a/benchmark/benchmark.5d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/5d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.5d_columnmajor.js b/benchmark/benchmark.5d_columnmajor.js deleted file mode 100644 index c13d756..0000000 --- a/benchmark/benchmark.5d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/5d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.5d_rowmajor.js b/benchmark/benchmark.5d_rowmajor.js deleted file mode 100644 index 85d1ec2..0000000 --- a/benchmark/benchmark.5d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/5d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/5.0 ) ); - sh = [ len, len, len, len, len ]; - len *= pow( len, 4 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.6d_blocked_columnmajor.js b/benchmark/benchmark.6d_blocked_columnmajor.js deleted file mode 100644 index 382626a..0000000 --- a/benchmark/benchmark.6d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/6d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.6d_blocked_rowmajor.js b/benchmark/benchmark.6d_blocked_rowmajor.js deleted file mode 100644 index 0c52168..0000000 --- a/benchmark/benchmark.6d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/6d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.6d_columnmajor.js b/benchmark/benchmark.6d_columnmajor.js deleted file mode 100644 index 3532fc3..0000000 --- a/benchmark/benchmark.6d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/6d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.6d_rowmajor.js b/benchmark/benchmark.6d_rowmajor.js deleted file mode 100644 index a2d469b..0000000 --- a/benchmark/benchmark.6d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/6d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/6.0 ) ); - sh = [ len, len, len, len, len, len ]; - len *= pow( len, 5 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.7d_blocked_columnmajor.js b/benchmark/benchmark.7d_blocked_columnmajor.js deleted file mode 100644 index 13361a2..0000000 --- a/benchmark/benchmark.7d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/7d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.7d_blocked_rowmajor.js b/benchmark/benchmark.7d_blocked_rowmajor.js deleted file mode 100644 index c9945ce..0000000 --- a/benchmark/benchmark.7d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/7d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.7d_columnmajor.js b/benchmark/benchmark.7d_columnmajor.js deleted file mode 100644 index 09fc943..0000000 --- a/benchmark/benchmark.7d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/7d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.7d_rowmajor.js b/benchmark/benchmark.7d_rowmajor.js deleted file mode 100644 index 82420d3..0000000 --- a/benchmark/benchmark.7d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/7d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/7.0 ) ); - sh = [ len, len, len, len, len, len, len ]; - len *= pow( len, 6 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.8d_blocked_columnmajor.js b/benchmark/benchmark.8d_blocked_columnmajor.js deleted file mode 100644 index af8c31d..0000000 --- a/benchmark/benchmark.8d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/8d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.8d_blocked_rowmajor.js b/benchmark/benchmark.8d_blocked_rowmajor.js deleted file mode 100644 index af8c31d..0000000 --- a/benchmark/benchmark.8d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/8d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.8d_columnmajor.js b/benchmark/benchmark.8d_columnmajor.js deleted file mode 100644 index 0a74907..0000000 --- a/benchmark/benchmark.8d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/8d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.8d_rowmajor.js b/benchmark/benchmark.8d_rowmajor.js deleted file mode 100644 index 7b42004..0000000 --- a/benchmark/benchmark.8d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/8d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/8.0 ) ); - sh = [ len, len, len, len, len, len, len, len ]; - len *= pow( len, 7 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.9d_blocked_columnmajor.js b/benchmark/benchmark.9d_blocked_columnmajor.js deleted file mode 100644 index 03ac476..0000000 --- a/benchmark/benchmark.9d_blocked_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/9d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.9d_blocked_rowmajor.js b/benchmark/benchmark.9d_blocked_rowmajor.js deleted file mode 100644 index 6fdc5ef..0000000 --- a/benchmark/benchmark.9d_blocked_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/9d_blocked.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+'::blocked:ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.9d_columnmajor.js b/benchmark/benchmark.9d_columnmajor.js deleted file mode 100644 index 543f13d..0000000 --- a/benchmark/benchmark.9d_columnmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/9d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'column-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/benchmark/benchmark.9d_rowmajor.js b/benchmark/benchmark.9d_rowmajor.js deleted file mode 100644 index 73be47c..0000000 --- a/benchmark/benchmark.9d_rowmajor.js +++ /dev/null @@ -1,152 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var floor = require( '@stdlib/math-base-special-floor' ); -var round = require( '@stdlib/math-base-special-round' ); -var identity = require( '@stdlib/number-float64-base-identity' ); -var filledarray = require( '@stdlib/array-filled' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var pkg = require( './../package.json' ).name; -var unary = require( './../lib/9d.js' ); - - -// VARIABLES // - -var types = [ 'float64' ]; -var order = 'row-major'; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - ndarray length -* @param {NonNegativeIntegerArray} shape - ndarray shape -* @param {string} xtype - input ndarray data type -* @param {string} ytype - output ndarray data type -* @returns {Function} benchmark function -*/ -function createBenchmark( len, shape, xtype, ytype ) { - var x; - var y; - var i; - - x = filledarray( 0.0, len, xtype ); - y = filledarray( 0.0, len, ytype ); - for ( i = 0; i < len; i++ ) { - x[ i ] = round( ( randu()*200.0 ) - 100.0 ); - } - x = { - 'dtype': xtype, - 'data': x, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - y = { - 'dtype': ytype, - 'data': y, - 'shape': shape, - 'strides': shape2strides( shape, order ), - 'offset': 0, - 'order': order - }; - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - unary( x, y, identity ); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y.data[ i%len ] ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var sh; - var t1; - var t2; - var f; - var i; - var j; - - min = 1; // 10^min - max = 6; // 10^max - - for ( j = 0; j < types.length; j++ ) { - t1 = types[ j ]; - t2 = types[ j ]; - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - sh = [ len/2, 2, 1, 1, 1, 1, 1, 1, 1 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, len/2 ]; - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - - len = floor( pow( len, 1.0/9.0 ) ); - sh = [ len, len, len, len, len, len, len, len, len ]; - len *= pow( len, 8 ); - f = createBenchmark( len, sh, t1, t2 ); - bench( pkg+':ndims='+sh.length+',len='+len+',shape=['+sh.join(',')+'],xorder='+order+',yorder='+order+',xtype='+t1+',ytype='+t2, f ); - } - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index d5439c0..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/base/unary" -%% click B href "https://github.com/stdlib-js/ndarray-base-unary/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-base-unary/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-base-unary/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-base-unary/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-base-unary/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/unary -[production-url]: https://github.com/stdlib-js/ndarray-base-unary/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-base-unary/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-base-unary/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-base-unary/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-base-unary/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-base-unary/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-base-unary/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8cc00be..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import unary from '../docs/types/index'; -export = unary; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 126c12f..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var tr=function(a,v){return function(){return v||a((v={exports:{}}).exports,v),v.exports}};var _r=tr(function(Ie,Dr){"use strict";var jv=require("@stdlib/ndarray-base-unary-loop-interchange-order"),qv=require("@stdlib/ndarray-base-unary-tiling-block-size");function kv(a,v,X){var r,B,Y,N,U,D,_,w,M,C,E,A,P,f,u,S,b,l,z,o,h,i,t,e,p;for(p=jv(a.shape,a.strides,v.strides),A=p.sh,u=p.sx,S=p.sy,r=qv(a.dtype,v.dtype),b=a.offset,l=v.offset,B=a.data,Y=v.data,D=u[0],w=S[0],N=a.accessors[0],U=v.accessors[1],e=A[1];e>0;)for(e0;)for(t0;)for(q0;)for(n0;)for(d0;)for(m0;)for(R0;)for(g0;)for(y0;)for(G0;)for(L0;)for(V0;)for(H0;)for(F0;)for(er0;)for($0;)for(W0;)for(T0;)for(J0;)for(vr0;)for(dr0;)for(fr0;)for(or0;)for(sr0;)for(ar0;)for(rr0;)for(Z0;)for(lr0;)for(yr0;)for(xr0;)for(ur0;)for(br0;)for(nr0;)for(ir0;)for(dr0;)for(qr0;)for(pr0;)for(cr0;)for(jr0;)for(hr0;)for(kr0;)for(Sr0;)for(lr0;)for(yr0;)for(Er0;)for(Ar0;)for(Pr0;)for(mr0;)for(Or0;)for(gr0;)for(zr0;)for(qr0;)for(pr0;)for(cr0;)for(i0;)for(h0;)for(d0;)for(x0;)for(k0;)for(g0;)for(y0;)for(j0;)for(O0;)for(V0;)for(H0;)for(F0;)for(I0;)for(K0;)for(W0;)for(T0;)for(J0;)for(vr0;)for(Q0;)for(G0;)for(or0;)for(sr0;)for(ar0;)for(rr0;)for(Z0;)for(er0;)for($0;)for(xr0;)for(ur0;)for(br0;)for(nr0;)for(ir0;)for(dr0;)for(fr0;)for(or0;)for(cr0;)for(jr0;)for(hr0;)for(kr0;)for(Sr0;)for(lr0;)for(yr0;)for(xr0;)for(ur0;)for(Pr0;)for(mr0;)for(Or0;)for(gr0;)for(zr0;)for(qr0;)for(pr0;)for(cr0;)for(jr0;)for(hr} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary2d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary2d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar ox1;\n\tvar oy1;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar j0;\n\tvar j1;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\tif ( j1 < bsize ) {\n\t\t\ts1 = j1;\n\t\t\tj1 = 0;\n\t\t} else {\n\t\t\ts1 = bsize;\n\t\t\tj1 -= bsize;\n\t\t}\n\t\tox1 = ox + ( j1*sx[1] );\n\t\toy1 = oy + ( j1*sy[1] );\n\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\tif ( j0 < bsize ) {\n\t\t\t\ts0 = j0;\n\t\t\t\tj0 = 0;\n\t\t\t} else {\n\t\t\t\ts0 = bsize;\n\t\t\t\tj0 -= bsize;\n\t\t\t}\n\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t// Compute loop offset increments...\n\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t// Iterate over the ndarray dimensions...\n\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary2d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 2, 1 ];\n* var sy = [ 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary3d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary3d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar ox1;\n\tvar ox2;\n\tvar oy1;\n\tvar oy2;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\tif ( j2 < bsize ) {\n\t\t\ts2 = j2;\n\t\t\tj2 = 0;\n\t\t} else {\n\t\t\ts2 = bsize;\n\t\t\tj2 -= bsize;\n\t\t}\n\t\tox2 = ox + ( j2*sx[2] );\n\t\toy2 = oy + ( j2*sy[2] );\n\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\tif ( j1 < bsize ) {\n\t\t\t\ts1 = j1;\n\t\t\t\tj1 = 0;\n\t\t\t} else {\n\t\t\t\ts1 = bsize;\n\t\t\t\tj1 -= bsize;\n\t\t\t}\n\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\ts0 = j0;\n\t\t\t\t\tj0 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts0 = bsize;\n\t\t\t\t\tj0 -= bsize;\n\t\t\t\t}\n\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t// Compute loop offset increments...\n\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary3d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary4d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary4d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\tif ( j3 < bsize ) {\n\t\t\ts3 = j3;\n\t\t\tj3 = 0;\n\t\t} else {\n\t\t\ts3 = bsize;\n\t\t\tj3 -= bsize;\n\t\t}\n\t\tox3 = ox + ( j3*sx[3] );\n\t\toy3 = oy + ( j3*sy[3] );\n\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\tif ( j2 < bsize ) {\n\t\t\t\ts2 = j2;\n\t\t\t\tj2 = 0;\n\t\t\t} else {\n\t\t\t\ts2 = bsize;\n\t\t\t\tj2 -= bsize;\n\t\t\t}\n\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\ts1 = j1;\n\t\t\t\t\tj1 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts1 = bsize;\n\t\t\t\t\tj1 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary4d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary5d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary5d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\tif ( j4 < bsize ) {\n\t\t\ts4 = j4;\n\t\t\tj4 = 0;\n\t\t} else {\n\t\t\ts4 = bsize;\n\t\t\tj4 -= bsize;\n\t\t}\n\t\tox4 = ox + ( j4*sx[4] );\n\t\toy4 = oy + ( j4*sy[4] );\n\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\tif ( j3 < bsize ) {\n\t\t\t\ts3 = j3;\n\t\t\t\tj3 = 0;\n\t\t\t} else {\n\t\t\t\ts3 = bsize;\n\t\t\t\tj3 -= bsize;\n\t\t\t}\n\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\ts2 = j2;\n\t\t\t\t\tj2 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts2 = bsize;\n\t\t\t\t\tj2 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) ); // eslint-disable-line max-len\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary5d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary6d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary6d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\tif ( j5 < bsize ) {\n\t\t\ts5 = j5;\n\t\t\tj5 = 0;\n\t\t} else {\n\t\t\ts5 = bsize;\n\t\t\tj5 -= bsize;\n\t\t}\n\t\tox5 = ox + ( j5*sx[5] );\n\t\toy5 = oy + ( j5*sy[5] );\n\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\tif ( j4 < bsize ) {\n\t\t\t\ts4 = j4;\n\t\t\t\tj4 = 0;\n\t\t\t} else {\n\t\t\t\ts4 = bsize;\n\t\t\t\tj4 -= bsize;\n\t\t\t}\n\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\ts3 = j3;\n\t\t\t\t\tj3 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts3 = bsize;\n\t\t\t\t\tj3 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary6d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary7d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary7d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\tif ( j6 < bsize ) {\n\t\t\ts6 = j6;\n\t\t\tj6 = 0;\n\t\t} else {\n\t\t\ts6 = bsize;\n\t\t\tj6 -= bsize;\n\t\t}\n\t\tox6 = ox + ( j6*sx[6] );\n\t\toy6 = oy + ( j6*sy[6] );\n\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\tif ( j5 < bsize ) {\n\t\t\t\ts5 = j5;\n\t\t\t\tj5 = 0;\n\t\t\t} else {\n\t\t\t\ts5 = bsize;\n\t\t\t\tj5 -= bsize;\n\t\t\t}\n\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\ts4 = j4;\n\t\t\t\t\tj4 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts4 = bsize;\n\t\t\t\t\tj4 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary7d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary8d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary8d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\tif ( j7 < bsize ) {\n\t\t\ts7 = j7;\n\t\t\tj7 = 0;\n\t\t} else {\n\t\t\ts7 = bsize;\n\t\t\tj7 -= bsize;\n\t\t}\n\t\tox7 = ox + ( j7*sx[7] );\n\t\toy7 = oy + ( j7*sy[7] );\n\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\tif ( j6 < bsize ) {\n\t\t\t\ts6 = j6;\n\t\t\t\tj6 = 0;\n\t\t\t} else {\n\t\t\t\ts6 = bsize;\n\t\t\t\tj6 -= bsize;\n\t\t\t}\n\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\ts5 = j5;\n\t\t\t\t\tj5 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts5 = bsize;\n\t\t\t\t\tj5 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary8d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary9d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary9d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\tif ( j8 < bsize ) {\n\t\t\ts8 = j8;\n\t\t\tj8 = 0;\n\t\t} else {\n\t\t\ts8 = bsize;\n\t\t\tj8 -= bsize;\n\t\t}\n\t\tox8 = ox + ( j8*sx[8] );\n\t\toy8 = oy + ( j8*sy[8] );\n\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\tif ( j7 < bsize ) {\n\t\t\t\ts7 = j7;\n\t\t\t\tj7 = 0;\n\t\t\t} else {\n\t\t\t\ts7 = bsize;\n\t\t\t\tj7 -= bsize;\n\t\t\t}\n\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\ts6 = j6;\n\t\t\t\t\tj6 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts6 = bsize;\n\t\t\t\t\tj6 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary9d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary10d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary10d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar ox9;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar oy9;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar s9;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar j9;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j9 = sh[9]; j9 > 0; ) {\n\t\tif ( j9 < bsize ) {\n\t\t\ts9 = j9;\n\t\t\tj9 = 0;\n\t\t} else {\n\t\t\ts9 = bsize;\n\t\t\tj9 -= bsize;\n\t\t}\n\t\tox9 = ox + ( j9*sx[9] );\n\t\toy9 = oy + ( j9*sy[9] );\n\t\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\t\tif ( j8 < bsize ) {\n\t\t\t\ts8 = j8;\n\t\t\t\tj8 = 0;\n\t\t\t} else {\n\t\t\t\ts8 = bsize;\n\t\t\t\tj8 -= bsize;\n\t\t\t}\n\t\t\tdx9 = sx[9] - ( s8*sx[8] );\n\t\t\tdy9 = sy[9] - ( s8*sy[8] );\n\t\t\tox8 = ox9 + ( j8*sx[8] );\n\t\t\toy8 = oy9 + ( j8*sy[8] );\n\t\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\t\tif ( j7 < bsize ) {\n\t\t\t\t\ts7 = j7;\n\t\t\t\t\tj7 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts7 = bsize;\n\t\t\t\t\tj7 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\t\ts6 = j6;\n\t\t\t\t\t\tj6 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts6 = bsize;\n\t\t\t\t\t\tj6 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\t\tfor ( i9 = 0; i9 < s9; i9++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx9;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy9;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary10d;\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\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary2d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0 ]\n*/\nfunction blockedunary2d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar ox1;\n\tvar oy1;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar j0;\n\tvar j1;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\tif ( j1 < bsize ) {\n\t\t\ts1 = j1;\n\t\t\tj1 = 0;\n\t\t} else {\n\t\t\ts1 = bsize;\n\t\t\tj1 -= bsize;\n\t\t}\n\t\tox1 = ox + ( j1*sx[1] );\n\t\toy1 = oy + ( j1*sy[1] );\n\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\tif ( j0 < bsize ) {\n\t\t\t\ts0 = j0;\n\t\t\t\tj0 = 0;\n\t\t\t} else {\n\t\t\t\ts0 = bsize;\n\t\t\t\tj0 -= bsize;\n\t\t\t}\n\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t// Compute loop offset increments...\n\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t// Iterate over the ndarray dimensions...\n\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary2d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary3d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary3d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar ox1;\n\tvar ox2;\n\tvar oy1;\n\tvar oy2;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\tif ( j2 < bsize ) {\n\t\t\ts2 = j2;\n\t\t\tj2 = 0;\n\t\t} else {\n\t\t\ts2 = bsize;\n\t\t\tj2 -= bsize;\n\t\t}\n\t\tox2 = ox + ( j2*sx[2] );\n\t\toy2 = oy + ( j2*sy[2] );\n\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\tif ( j1 < bsize ) {\n\t\t\t\ts1 = j1;\n\t\t\t\tj1 = 0;\n\t\t\t} else {\n\t\t\t\ts1 = bsize;\n\t\t\t\tj1 -= bsize;\n\t\t\t}\n\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\ts0 = j0;\n\t\t\t\t\tj0 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts0 = bsize;\n\t\t\t\t\tj0 -= bsize;\n\t\t\t\t}\n\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t// Compute loop offset increments...\n\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary3d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 4, 4, 1 ];\n* var sy = [ 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary4d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary4d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\tif ( j3 < bsize ) {\n\t\t\ts3 = j3;\n\t\t\tj3 = 0;\n\t\t} else {\n\t\t\ts3 = bsize;\n\t\t\tj3 -= bsize;\n\t\t}\n\t\tox3 = ox + ( j3*sx[3] );\n\t\toy3 = oy + ( j3*sy[3] );\n\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\tif ( j2 < bsize ) {\n\t\t\t\ts2 = j2;\n\t\t\t\tj2 = 0;\n\t\t\t} else {\n\t\t\t\ts2 = bsize;\n\t\t\t\tj2 -= bsize;\n\t\t\t}\n\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\ts1 = j1;\n\t\t\t\t\tj1 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts1 = bsize;\n\t\t\t\t\tj1 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary4d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary5d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary5d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\tif ( j4 < bsize ) {\n\t\t\ts4 = j4;\n\t\t\tj4 = 0;\n\t\t} else {\n\t\t\ts4 = bsize;\n\t\t\tj4 -= bsize;\n\t\t}\n\t\tox4 = ox + ( j4*sx[4] );\n\t\toy4 = oy + ( j4*sy[4] );\n\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\tif ( j3 < bsize ) {\n\t\t\t\ts3 = j3;\n\t\t\t\tj3 = 0;\n\t\t\t} else {\n\t\t\t\ts3 = bsize;\n\t\t\t\tj3 -= bsize;\n\t\t\t}\n\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\ts2 = j2;\n\t\t\t\t\tj2 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts2 = bsize;\n\t\t\t\t\tj2 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary5d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary6d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary6d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\tif ( j5 < bsize ) {\n\t\t\ts5 = j5;\n\t\t\tj5 = 0;\n\t\t} else {\n\t\t\ts5 = bsize;\n\t\t\tj5 -= bsize;\n\t\t}\n\t\tox5 = ox + ( j5*sx[5] );\n\t\toy5 = oy + ( j5*sy[5] );\n\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\tif ( j4 < bsize ) {\n\t\t\t\ts4 = j4;\n\t\t\t\tj4 = 0;\n\t\t\t} else {\n\t\t\t\ts4 = bsize;\n\t\t\t\tj4 -= bsize;\n\t\t\t}\n\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\ts3 = j3;\n\t\t\t\t\tj3 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts3 = bsize;\n\t\t\t\t\tj3 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary6d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary7d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary7d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\tif ( j6 < bsize ) {\n\t\t\ts6 = j6;\n\t\t\tj6 = 0;\n\t\t} else {\n\t\t\ts6 = bsize;\n\t\t\tj6 -= bsize;\n\t\t}\n\t\tox6 = ox + ( j6*sx[6] );\n\t\toy6 = oy + ( j6*sy[6] );\n\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\tif ( j5 < bsize ) {\n\t\t\t\ts5 = j5;\n\t\t\t\tj5 = 0;\n\t\t\t} else {\n\t\t\t\ts5 = bsize;\n\t\t\t\tj5 -= bsize;\n\t\t\t}\n\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\ts4 = j4;\n\t\t\t\t\tj4 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts4 = bsize;\n\t\t\t\t\tj4 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary7d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary8d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary8d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\tif ( j7 < bsize ) {\n\t\t\ts7 = j7;\n\t\t\tj7 = 0;\n\t\t} else {\n\t\t\ts7 = bsize;\n\t\t\tj7 -= bsize;\n\t\t}\n\t\tox7 = ox + ( j7*sx[7] );\n\t\toy7 = oy + ( j7*sy[7] );\n\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\tif ( j6 < bsize ) {\n\t\t\t\ts6 = j6;\n\t\t\t\tj6 = 0;\n\t\t\t} else {\n\t\t\t\ts6 = bsize;\n\t\t\t\tj6 -= bsize;\n\t\t\t}\n\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\ts5 = j5;\n\t\t\t\t\tj5 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts5 = bsize;\n\t\t\t\t\tj5 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary8d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary9d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary9d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\tif ( j8 < bsize ) {\n\t\t\ts8 = j8;\n\t\t\tj8 = 0;\n\t\t} else {\n\t\t\ts8 = bsize;\n\t\t\tj8 -= bsize;\n\t\t}\n\t\tox8 = ox + ( j8*sx[8] );\n\t\toy8 = oy + ( j8*sy[8] );\n\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\tif ( j7 < bsize ) {\n\t\t\t\ts7 = j7;\n\t\t\t\tj7 = 0;\n\t\t\t} else {\n\t\t\t\ts7 = bsize;\n\t\t\t\tj7 -= bsize;\n\t\t\t}\n\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\ts6 = j6;\n\t\t\t\t\tj6 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts6 = bsize;\n\t\t\t\t\tj6 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary9d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nvar loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' );\nvar blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary10d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary10d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar ox9;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar oy9;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar s9;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar j9;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j9 = sh[9]; j9 > 0; ) {\n\t\tif ( j9 < bsize ) {\n\t\t\ts9 = j9;\n\t\t\tj9 = 0;\n\t\t} else {\n\t\t\ts9 = bsize;\n\t\t\tj9 -= bsize;\n\t\t}\n\t\tox9 = ox + ( j9*sx[9] );\n\t\toy9 = oy + ( j9*sy[9] );\n\t\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\t\tif ( j8 < bsize ) {\n\t\t\t\ts8 = j8;\n\t\t\t\tj8 = 0;\n\t\t\t} else {\n\t\t\t\ts8 = bsize;\n\t\t\t\tj8 -= bsize;\n\t\t\t}\n\t\t\tdx9 = sx[9] - ( s8*sx[8] );\n\t\t\tdy9 = sy[9] - ( s8*sy[8] );\n\t\t\tox8 = ox9 + ( j8*sx[8] );\n\t\t\toy8 = oy9 + ( j8*sy[8] );\n\t\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\t\tif ( j7 < bsize ) {\n\t\t\t\t\ts7 = j7;\n\t\t\t\t\tj7 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts7 = bsize;\n\t\t\t\t\tj7 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\t\ts6 = j6;\n\t\t\t\t\t\tj6 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts6 = bsize;\n\t\t\t\t\t\tj6 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\t\tfor ( i9 = 0; i9 < s9; i9++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx9;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy9;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = blockedunary10d;\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* Applies a unary callback to elements in a zero-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] );\n* var ybuf = new Complex64Array( 2 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [];\n*\n* // Define the array strides:\n* var sx = [ 0 ];\n* var sy = [ 0 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary0d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 30.0\n*\n* var im = imagf( v );\n* // returns 40.0\n*/\nfunction unary0d( x, y, fcn ) {\n\ty.accessors[ 1 ]( y.data, y.offset, fcn( x.accessors[ 0 ]( x.data, x.offset ) ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary0d;\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* Applies a unary callback to elements in a one-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 4 ];\n*\n* // Define the array strides:\n* var sx = [ 1 ];\n* var sy = [ 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary1d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary1d( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dy0;\n\tvar S0;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables: dimensions and loop offset (pointer) increments...\n\tS0 = x.shape[ 0 ];\n\tdx0 = x.strides[ 0 ];\n\tdy0 = y.strides[ 0 ];\n\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\tix += dx0;\n\t\tiy += dy0;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary1d;\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* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary2d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary2d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 1 ];\n\t\tS1 = sh[ 0 ];\n\t\tdx0 = sx[ 1 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 1 ];\n\t\tdy1 = sy[ 0 ] - ( S0*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\tix += dx0;\n\t\t\tiy += dy0;\n\t\t}\n\t\tix += dx1;\n\t\tiy += dy1;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary2d;\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* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 2, 1 ];\n* var sy = [ 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary3d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary3d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 2 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 0 ];\n\t\tdx0 = sx[ 2 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[2] );\n\t\tdx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 2 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[2] );\n\t\tdy2 = sy[ 0 ] - ( S1*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\tix += dx0;\n\t\t\t\tiy += dy0;\n\t\t\t}\n\t\t\tix += dx1;\n\t\t\tiy += dy1;\n\t\t}\n\t\tix += dx2;\n\t\tiy += dy2;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary3d;\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* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary4d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary4d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 3 ];\n\t\tS1 = sh[ 2 ];\n\t\tS2 = sh[ 1 ];\n\t\tS3 = sh[ 0 ];\n\t\tdx0 = sx[ 3 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 2 ] - ( S0*sx[3] );\n\t\tdx2 = sx[ 1 ] - ( S1*sx[2] );\n\t\tdx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 3 ];\n\t\tdy1 = sy[ 2 ] - ( S0*sy[3] );\n\t\tdy2 = sy[ 1 ] - ( S1*sy[2] );\n\t\tdy3 = sy[ 0 ] - ( S2*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t\tix += dx2;\n\t\t\tiy += dy2;\n\t\t}\n\t\tix += dx3;\n\t\tiy += dy3;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary4d;\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* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary5d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary5d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 4 ];\n\t\tS1 = sh[ 3 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 1 ];\n\t\tS4 = sh[ 0 ];\n\t\tdx0 = sx[ 4 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 3 ] - ( S0*sx[4] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[3] );\n\t\tdx3 = sx[ 1 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 4 ];\n\t\tdy1 = sy[ 3 ] - ( S0*sy[4] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[3] );\n\t\tdy3 = sy[ 1 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 0 ] - ( S3*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx1;\n\t\t\t\t\tiy += dy1;\n\t\t\t\t}\n\t\t\t\tix += dx2;\n\t\t\t\tiy += dy2;\n\t\t\t}\n\t\t\tix += dx3;\n\t\t\tiy += dy3;\n\t\t}\n\t\tix += dx4;\n\t\tiy += dy4;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary5d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary6d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary6d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 5 ];\n\t\tS1 = sh[ 4 ];\n\t\tS2 = sh[ 3 ];\n\t\tS3 = sh[ 2 ];\n\t\tS4 = sh[ 1 ];\n\t\tS5 = sh[ 0 ];\n\t\tdx0 = sx[ 5 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 4 ] - ( S0*sx[5] );\n\t\tdx2 = sx[ 3 ] - ( S1*sx[4] );\n\t\tdx3 = sx[ 2 ] - ( S2*sx[3] );\n\t\tdx4 = sx[ 1 ] - ( S3*sx[2] );\n\t\tdx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 5 ];\n\t\tdy1 = sy[ 4 ] - ( S0*sy[5] );\n\t\tdy2 = sy[ 3 ] - ( S1*sy[4] );\n\t\tdy3 = sy[ 2 ] - ( S2*sy[3] );\n\t\tdy4 = sy[ 1 ] - ( S3*sy[2] );\n\t\tdy5 = sy[ 0 ] - ( S4*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t\tix += dx3;\n\t\t\t\tiy += dy3;\n\t\t\t}\n\t\t\tix += dx4;\n\t\t\tiy += dy4;\n\t\t}\n\t\tix += dx5;\n\t\tiy += dy5;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary6d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary7d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary7d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 6 ];\n\t\tS1 = sh[ 5 ];\n\t\tS2 = sh[ 4 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 2 ];\n\t\tS5 = sh[ 1 ];\n\t\tS6 = sh[ 0 ];\n\t\tdx0 = sx[ 6 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 5 ] - ( S0*sx[6] );\n\t\tdx2 = sx[ 4 ] - ( S1*sx[5] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[4] );\n\t\tdx4 = sx[ 2 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 1 ] - ( S4*sx[2] );\n\t\tdx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 6 ];\n\t\tdy1 = sy[ 5 ] - ( S0*sy[6] );\n\t\tdy2 = sy[ 4 ] - ( S1*sy[5] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[4] );\n\t\tdy4 = sy[ 2 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 1 ] - ( S4*sy[2] );\n\t\tdy6 = sy[ 0 ] - ( S5*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx3;\n\t\t\t\t\tiy += dy3;\n\t\t\t\t}\n\t\t\t\tix += dx4;\n\t\t\t\tiy += dy4;\n\t\t\t}\n\t\t\tix += dx5;\n\t\t\tiy += dy5;\n\t\t}\n\t\tix += dx6;\n\t\tiy += dy6;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary7d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary8d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary8d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 7 ];\n\t\tS1 = sh[ 6 ];\n\t\tS2 = sh[ 5 ];\n\t\tS3 = sh[ 4 ];\n\t\tS4 = sh[ 3 ];\n\t\tS5 = sh[ 2 ];\n\t\tS6 = sh[ 1 ];\n\t\tS7 = sh[ 0 ];\n\t\tdx0 = sx[ 7 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 6 ] - ( S0*sx[7] );\n\t\tdx2 = sx[ 5 ] - ( S1*sx[6] );\n\t\tdx3 = sx[ 4 ] - ( S2*sx[5] );\n\t\tdx4 = sx[ 3 ] - ( S3*sx[4] );\n\t\tdx5 = sx[ 2 ] - ( S4*sx[3] );\n\t\tdx6 = sx[ 1 ] - ( S5*sx[2] );\n\t\tdx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 7 ];\n\t\tdy1 = sy[ 6 ] - ( S0*sy[7] );\n\t\tdy2 = sy[ 5 ] - ( S1*sy[6] );\n\t\tdy3 = sy[ 4 ] - ( S2*sy[5] );\n\t\tdy4 = sy[ 3 ] - ( S3*sy[4] );\n\t\tdy5 = sy[ 2 ] - ( S4*sy[3] );\n\t\tdy6 = sy[ 1 ] - ( S5*sy[2] );\n\t\tdy7 = sy[ 0 ] - ( S6*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx4;\n\t\t\t\t\tiy += dy4;\n\t\t\t\t}\n\t\t\t\tix += dx5;\n\t\t\t\tiy += dy5;\n\t\t\t}\n\t\t\tix += dx6;\n\t\t\tiy += dy6;\n\t\t}\n\t\tix += dx7;\n\t\tiy += dy7;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary8d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary9d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary9d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 8 ];\n\t\tS1 = sh[ 7 ];\n\t\tS2 = sh[ 6 ];\n\t\tS3 = sh[ 5 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 3 ];\n\t\tS6 = sh[ 2 ];\n\t\tS7 = sh[ 1 ];\n\t\tS8 = sh[ 0 ];\n\t\tdx0 = sx[ 8 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 7 ] - ( S0*sx[8] );\n\t\tdx2 = sx[ 6 ] - ( S1*sx[7] );\n\t\tdx3 = sx[ 5 ] - ( S2*sx[6] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[5] );\n\t\tdx5 = sx[ 3 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 2 ] - ( S5*sx[3] );\n\t\tdx7 = sx[ 1 ] - ( S6*sx[2] );\n\t\tdx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 8 ];\n\t\tdy1 = sy[ 7 ] - ( S0*sy[8] );\n\t\tdy2 = sy[ 6 ] - ( S1*sy[7] );\n\t\tdy3 = sy[ 5 ] - ( S2*sy[6] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[5] );\n\t\tdy5 = sy[ 3 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 2 ] - ( S5*sy[3] );\n\t\tdy7 = sy[ 1 ] - ( S6*sy[2] );\n\t\tdy8 = sy[ 0 ] - ( S7*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx5;\n\t\t\t\t\tiy += dy5;\n\t\t\t\t}\n\t\t\t\tix += dx6;\n\t\t\t\tiy += dy6;\n\t\t\t}\n\t\t\tix += dx7;\n\t\t\tiy += dy7;\n\t\t}\n\t\tix += dx8;\n\t\tiy += dy8;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary9d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary10d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar S9;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 9 ];\n\t\tS1 = sh[ 8 ];\n\t\tS2 = sh[ 7 ];\n\t\tS3 = sh[ 6 ];\n\t\tS4 = sh[ 5 ];\n\t\tS5 = sh[ 4 ];\n\t\tS6 = sh[ 3 ];\n\t\tS7 = sh[ 2 ];\n\t\tS8 = sh[ 1 ];\n\t\tS9 = sh[ 0 ];\n\t\tdx0 = sx[ 9 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 8 ] - ( S0*sx[9] );\n\t\tdx2 = sx[ 7 ] - ( S1*sx[8] );\n\t\tdx3 = sx[ 6 ] - ( S2*sx[7] );\n\t\tdx4 = sx[ 5 ] - ( S3*sx[6] );\n\t\tdx5 = sx[ 4 ] - ( S4*sx[5] );\n\t\tdx6 = sx[ 3 ] - ( S5*sx[4] );\n\t\tdx7 = sx[ 2 ] - ( S6*sx[3] );\n\t\tdx8 = sx[ 1 ] - ( S7*sx[2] );\n\t\tdx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 9 ];\n\t\tdy1 = sy[ 8 ] - ( S0*sy[9] );\n\t\tdy2 = sy[ 7 ] - ( S1*sy[8] );\n\t\tdy3 = sy[ 6 ] - ( S2*sy[7] );\n\t\tdy4 = sy[ 5 ] - ( S3*sy[6] );\n\t\tdy5 = sy[ 4 ] - ( S4*sy[5] );\n\t\tdy6 = sy[ 3 ] - ( S5*sy[4] );\n\t\tdy7 = sy[ 2 ] - ( S6*sy[3] );\n\t\tdy8 = sy[ 1 ] - ( S7*sy[2] );\n\t\tdy9 = sy[ 0 ] - ( S8*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tS9 = sh[ 9 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] );\n\t\tdx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t\tdy9 = sy[ 9 ] - ( S8*sy[8] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i9 = 0; i9 < S9; i9++ ) {\n\t\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) ); // eslint-disable-line max-len\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx6;\n\t\t\t\t\tiy += dy6;\n\t\t\t\t}\n\t\t\t\tix += dx7;\n\t\t\t\tiy += dy7;\n\t\t\t}\n\t\t\tix += dx8;\n\t\t\tiy += dy8;\n\t\t}\n\t\tix += dx9;\n\t\tiy += dy9;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary10d;\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\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar vind2bind = require( '@stdlib/ndarray-base-vind2bind' );\n\n\n// VARIABLES //\n\nvar MODE = 'throw';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an n-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Complex64Array = require( '@stdlib/array-complex64' );\n* var Complex64 = require( '@stdlib/complex-float32-ctor' );\n* var realf = require( '@stdlib/complex-float32-real' );\n* var imagf = require( '@stdlib/complex-float32-imag' );\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unarynd( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unarynd( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar ordx;\n\tvar ordy;\n\tvar len;\n\tvar get;\n\tvar set;\n\tvar sh;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tsh = x.shape;\n\n\t// Compute the total number of elements over which to iterate:\n\tlen = numel( sh );\n\n\t// Cache references to the input and output ndarray data buffers:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache references to the respective stride arrays:\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays:\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache the respective array orders:\n\tordx = x.order;\n\tordy = y.order;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tix = vind2bind( sh, sx, ox, ordx, i, MODE );\n\t\tiy = vind2bind( sh, sy, oy, ordy, i, MODE );\n\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unarynd;\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* Applies a unary callback to elements in a zero-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0 ] );\n* var ybuf = new Float64Array( 1 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [];\n*\n* // Define the array strides:\n* var sx = [ 0 ];\n* var sy = [ 0 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary0d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0 ]\n*/\nfunction unary0d( x, y, fcn ) {\n\ty.data[ y.offset ] = fcn( x.data[ x.offset ] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary0d;\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* Applies a unary callback to elements in a one-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 4 ];\n*\n* // Define the array strides:\n* var sx = [ 2 ];\n* var sy = [ 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary1d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 40.0, 60.0, 80.0 ]\n*/\nfunction unary1d( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dy0;\n\tvar S0;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables: dimensions and loop offset (pointer) increments...\n\tS0 = x.shape[ 0 ];\n\tdx0 = x.strides[ 0 ];\n\tdy0 = y.strides[ 0 ];\n\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\tix += dx0;\n\t\tiy += dy0;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary1d;\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* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary2d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0 ]\n*/\nfunction unary2d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 1 ];\n\t\tS1 = sh[ 0 ];\n\t\tdx0 = sx[ 1 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 1 ];\n\t\tdy1 = sy[ 0 ] - ( S0*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\tix += dx0;\n\t\t\tiy += dy0;\n\t\t}\n\t\tix += dx1;\n\t\tiy += dy1;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary2d;\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* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary3d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary3d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 2 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 0 ];\n\t\tdx0 = sx[ 2 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[2] );\n\t\tdx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 2 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[2] );\n\t\tdy2 = sy[ 0 ] - ( S1*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\tix += dx0;\n\t\t\t\tiy += dy0;\n\t\t\t}\n\t\t\tix += dx1;\n\t\t\tiy += dy1;\n\t\t}\n\t\tix += dx2;\n\t\tiy += dy2;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary3d;\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* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 4, 4, 1 ];\n* var sy = [ 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary4d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary4d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 3 ];\n\t\tS1 = sh[ 2 ];\n\t\tS2 = sh[ 1 ];\n\t\tS3 = sh[ 0 ];\n\t\tdx0 = sx[ 3 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 2 ] - ( S0*sx[3] );\n\t\tdx2 = sx[ 1 ] - ( S1*sx[2] );\n\t\tdx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 3 ];\n\t\tdy1 = sy[ 2 ] - ( S0*sy[3] );\n\t\tdy2 = sy[ 1 ] - ( S1*sy[2] );\n\t\tdy3 = sy[ 0 ] - ( S2*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t\tix += dx2;\n\t\t\tiy += dy2;\n\t\t}\n\t\tix += dx3;\n\t\tiy += dy3;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary4d;\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* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary5d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary5d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 4 ];\n\t\tS1 = sh[ 3 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 1 ];\n\t\tS4 = sh[ 0 ];\n\t\tdx0 = sx[ 4 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 3 ] - ( S0*sx[4] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[3] );\n\t\tdx3 = sx[ 1 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 4 ];\n\t\tdy1 = sy[ 3 ] - ( S0*sy[4] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[3] );\n\t\tdy3 = sy[ 1 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 0 ] - ( S3*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx1;\n\t\t\t\t\tiy += dy1;\n\t\t\t\t}\n\t\t\t\tix += dx2;\n\t\t\t\tiy += dy2;\n\t\t\t}\n\t\t\tix += dx3;\n\t\t\tiy += dy3;\n\t\t}\n\t\tix += dx4;\n\t\tiy += dy4;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary5d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary6d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary6d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 5 ];\n\t\tS1 = sh[ 4 ];\n\t\tS2 = sh[ 3 ];\n\t\tS3 = sh[ 2 ];\n\t\tS4 = sh[ 1 ];\n\t\tS5 = sh[ 0 ];\n\t\tdx0 = sx[ 5 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 4 ] - ( S0*sx[5] );\n\t\tdx2 = sx[ 3 ] - ( S1*sx[4] );\n\t\tdx3 = sx[ 2 ] - ( S2*sx[3] );\n\t\tdx4 = sx[ 1 ] - ( S3*sx[2] );\n\t\tdx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 5 ];\n\t\tdy1 = sy[ 4 ] - ( S0*sy[5] );\n\t\tdy2 = sy[ 3 ] - ( S1*sy[4] );\n\t\tdy3 = sy[ 2 ] - ( S2*sy[3] );\n\t\tdy4 = sy[ 1 ] - ( S3*sy[2] );\n\t\tdy5 = sy[ 0 ] - ( S4*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t\tix += dx3;\n\t\t\t\tiy += dy3;\n\t\t\t}\n\t\t\tix += dx4;\n\t\t\tiy += dy4;\n\t\t}\n\t\tix += dx5;\n\t\tiy += dy5;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary6d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary7d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary7d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 6 ];\n\t\tS1 = sh[ 5 ];\n\t\tS2 = sh[ 4 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 2 ];\n\t\tS5 = sh[ 1 ];\n\t\tS6 = sh[ 0 ];\n\t\tdx0 = sx[ 6 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 5 ] - ( S0*sx[6] );\n\t\tdx2 = sx[ 4 ] - ( S1*sx[5] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[4] );\n\t\tdx4 = sx[ 2 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 1 ] - ( S4*sx[2] );\n\t\tdx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 6 ];\n\t\tdy1 = sy[ 5 ] - ( S0*sy[6] );\n\t\tdy2 = sy[ 4 ] - ( S1*sy[5] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[4] );\n\t\tdy4 = sy[ 2 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 1 ] - ( S4*sy[2] );\n\t\tdy6 = sy[ 0 ] - ( S5*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx3;\n\t\t\t\t\tiy += dy3;\n\t\t\t\t}\n\t\t\t\tix += dx4;\n\t\t\t\tiy += dy4;\n\t\t\t}\n\t\t\tix += dx5;\n\t\t\tiy += dy5;\n\t\t}\n\t\tix += dx6;\n\t\tiy += dy6;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary7d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary8d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary8d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 7 ];\n\t\tS1 = sh[ 6 ];\n\t\tS2 = sh[ 5 ];\n\t\tS3 = sh[ 4 ];\n\t\tS4 = sh[ 3 ];\n\t\tS5 = sh[ 2 ];\n\t\tS6 = sh[ 1 ];\n\t\tS7 = sh[ 0 ];\n\t\tdx0 = sx[ 7 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 6 ] - ( S0*sx[7] );\n\t\tdx2 = sx[ 5 ] - ( S1*sx[6] );\n\t\tdx3 = sx[ 4 ] - ( S2*sx[5] );\n\t\tdx4 = sx[ 3 ] - ( S3*sx[4] );\n\t\tdx5 = sx[ 2 ] - ( S4*sx[3] );\n\t\tdx6 = sx[ 1 ] - ( S5*sx[2] );\n\t\tdx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 7 ];\n\t\tdy1 = sy[ 6 ] - ( S0*sy[7] );\n\t\tdy2 = sy[ 5 ] - ( S1*sy[6] );\n\t\tdy3 = sy[ 4 ] - ( S2*sy[5] );\n\t\tdy4 = sy[ 3 ] - ( S3*sy[4] );\n\t\tdy5 = sy[ 2 ] - ( S4*sy[3] );\n\t\tdy6 = sy[ 1 ] - ( S5*sy[2] );\n\t\tdy7 = sy[ 0 ] - ( S6*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx4;\n\t\t\t\t\tiy += dy4;\n\t\t\t\t}\n\t\t\t\tix += dx5;\n\t\t\t\tiy += dy5;\n\t\t\t}\n\t\t\tix += dx6;\n\t\t\tiy += dy6;\n\t\t}\n\t\tix += dx7;\n\t\tiy += dy7;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary8d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary9d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary9d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 8 ];\n\t\tS1 = sh[ 7 ];\n\t\tS2 = sh[ 6 ];\n\t\tS3 = sh[ 5 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 3 ];\n\t\tS6 = sh[ 2 ];\n\t\tS7 = sh[ 1 ];\n\t\tS8 = sh[ 0 ];\n\t\tdx0 = sx[ 8 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 7 ] - ( S0*sx[8] );\n\t\tdx2 = sx[ 6 ] - ( S1*sx[7] );\n\t\tdx3 = sx[ 5 ] - ( S2*sx[6] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[5] );\n\t\tdx5 = sx[ 3 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 2 ] - ( S5*sx[3] );\n\t\tdx7 = sx[ 1 ] - ( S6*sx[2] );\n\t\tdx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 8 ];\n\t\tdy1 = sy[ 7 ] - ( S0*sy[8] );\n\t\tdy2 = sy[ 6 ] - ( S1*sy[7] );\n\t\tdy3 = sy[ 5 ] - ( S2*sy[6] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[5] );\n\t\tdy5 = sy[ 3 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 2 ] - ( S5*sy[3] );\n\t\tdy7 = sy[ 1 ] - ( S6*sy[2] );\n\t\tdy8 = sy[ 0 ] - ( S7*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx5;\n\t\t\t\t\tiy += dy5;\n\t\t\t\t}\n\t\t\t\tix += dx6;\n\t\t\t\tiy += dy6;\n\t\t\t}\n\t\t\tix += dx7;\n\t\t\tiy += dy7;\n\t\t}\n\t\tix += dx8;\n\t\tiy += dy8;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary9d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary10d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar S9;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 9 ];\n\t\tS1 = sh[ 8 ];\n\t\tS2 = sh[ 7 ];\n\t\tS3 = sh[ 6 ];\n\t\tS4 = sh[ 5 ];\n\t\tS5 = sh[ 4 ];\n\t\tS6 = sh[ 3 ];\n\t\tS7 = sh[ 2 ];\n\t\tS8 = sh[ 1 ];\n\t\tS9 = sh[ 0 ];\n\t\tdx0 = sx[ 9 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 8 ] - ( S0*sx[9] );\n\t\tdx2 = sx[ 7 ] - ( S1*sx[8] );\n\t\tdx3 = sx[ 6 ] - ( S2*sx[7] );\n\t\tdx4 = sx[ 5 ] - ( S3*sx[6] );\n\t\tdx5 = sx[ 4 ] - ( S4*sx[5] );\n\t\tdx6 = sx[ 3 ] - ( S5*sx[4] );\n\t\tdx7 = sx[ 2 ] - ( S6*sx[3] );\n\t\tdx8 = sx[ 1 ] - ( S7*sx[2] );\n\t\tdx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 9 ];\n\t\tdy1 = sy[ 8 ] - ( S0*sy[9] );\n\t\tdy2 = sy[ 7 ] - ( S1*sy[8] );\n\t\tdy3 = sy[ 6 ] - ( S2*sy[7] );\n\t\tdy4 = sy[ 5 ] - ( S3*sy[6] );\n\t\tdy5 = sy[ 4 ] - ( S4*sy[5] );\n\t\tdy6 = sy[ 3 ] - ( S5*sy[4] );\n\t\tdy7 = sy[ 2 ] - ( S6*sy[3] );\n\t\tdy8 = sy[ 1 ] - ( S7*sy[2] );\n\t\tdy9 = sy[ 0 ] - ( S8*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tS9 = sh[ 9 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] );\n\t\tdx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t\tdy9 = sy[ 9 ] - ( S8*sy[8] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i9 = 0; i9 < S9; i9++ ) {\n\t\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx6;\n\t\t\t\t\tiy += dy6;\n\t\t\t\t}\n\t\t\t\tix += dx7;\n\t\t\t\tiy += dy7;\n\t\t\t}\n\t\t\tix += dx8;\n\t\t\tiy += dy8;\n\t\t}\n\t\tix += dx9;\n\t\tiy += dy9;\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary10d;\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\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar vind2bind = require( '@stdlib/ndarray-base-vind2bind' );\n\n\n// VARIABLES //\n\nvar MODE = 'throw';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an n-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unarynd( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0 ]\n*/\nfunction unarynd( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar ordx;\n\tvar ordy;\n\tvar len;\n\tvar sh;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tsh = x.shape;\n\n\t// Compute the total number of elements over which to iterate:\n\tlen = numel( sh );\n\n\t// Cache references to the input and output ndarray data buffers:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache references to the respective stride arrays:\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays:\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache the respective array orders:\n\tordx = x.order;\n\tordy = y.order;\n\n\t// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tix = vind2bind( sh, sx, ox, ordx, i, MODE );\n\t\tiy = vind2bind( sh, sy, oy, ordy, i, MODE );\n\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = unarynd;\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\nvar iterationOrder = require( '@stdlib/ndarray-base-iteration-order' );\nvar strides2order = require( '@stdlib/ndarray-base-strides2order' );\nvar minmaxViewBufferIndex = require( '@stdlib/ndarray-base-minmax-view-buffer-index' );\nvar ndarray2object = require( '@stdlib/ndarray-base-ndarraylike2object' );\nvar format = require( '@stdlib/string-format' );\nvar blockedaccessorunary2d = require( './2d_blocked_accessors.js' );\nvar blockedaccessorunary3d = require( './3d_blocked_accessors.js' );\nvar blockedaccessorunary4d = require( './4d_blocked_accessors.js' );\nvar blockedaccessorunary5d = require( './5d_blocked_accessors.js' );\nvar blockedaccessorunary6d = require( './6d_blocked_accessors.js' );\nvar blockedaccessorunary7d = require( './7d_blocked_accessors.js' );\nvar blockedaccessorunary8d = require( './8d_blocked_accessors.js' );\nvar blockedaccessorunary9d = require( './9d_blocked_accessors.js' );\nvar blockedaccessorunary10d = require( './10d_blocked_accessors.js' );\nvar blockedunary2d = require( './2d_blocked.js' );\nvar blockedunary3d = require( './3d_blocked.js' );\nvar blockedunary4d = require( './4d_blocked.js' );\nvar blockedunary5d = require( './5d_blocked.js' );\nvar blockedunary6d = require( './6d_blocked.js' );\nvar blockedunary7d = require( './7d_blocked.js' );\nvar blockedunary8d = require( './8d_blocked.js' );\nvar blockedunary9d = require( './9d_blocked.js' );\nvar blockedunary10d = require( './10d_blocked.js' );\nvar accessorunary0d = require( './0d_accessors.js' );\nvar accessorunary1d = require( './1d_accessors.js' );\nvar accessorunary2d = require( './2d_accessors.js' );\nvar accessorunary3d = require( './3d_accessors.js' );\nvar accessorunary4d = require( './4d_accessors.js' );\nvar accessorunary5d = require( './5d_accessors.js' );\nvar accessorunary6d = require( './6d_accessors.js' );\nvar accessorunary7d = require( './7d_accessors.js' );\nvar accessorunary8d = require( './8d_accessors.js' );\nvar accessorunary9d = require( './9d_accessors.js' );\nvar accessorunary10d = require( './10d_accessors.js' );\nvar accessorunarynd = require( './nd_accessors.js' );\nvar unary0d = require( './0d.js' );\nvar unary1d = require( './1d.js' );\nvar unary2d = require( './2d.js' );\nvar unary3d = require( './3d.js' );\nvar unary4d = require( './4d.js' );\nvar unary5d = require( './5d.js' );\nvar unary6d = require( './6d.js' );\nvar unary7d = require( './7d.js' );\nvar unary8d = require( './8d.js' );\nvar unary9d = require( './9d.js' );\nvar unary10d = require( './10d.js' );\nvar unarynd = require( './nd.js' );\n\n\n// VARIABLES //\n\nvar UNARY = [\n\tunary0d,\n\tunary1d,\n\tunary2d,\n\tunary3d,\n\tunary4d,\n\tunary5d,\n\tunary6d,\n\tunary7d,\n\tunary8d,\n\tunary9d,\n\tunary10d\n];\nvar ACCESSOR_UNARY = [\n\taccessorunary0d,\n\taccessorunary1d,\n\taccessorunary2d,\n\taccessorunary3d,\n\taccessorunary4d,\n\taccessorunary5d,\n\taccessorunary6d,\n\taccessorunary7d,\n\taccessorunary8d,\n\taccessorunary9d,\n\taccessorunary10d\n];\nvar BLOCKED_UNARY = [\n\tblockedunary2d, // 0\n\tblockedunary3d,\n\tblockedunary4d,\n\tblockedunary5d,\n\tblockedunary6d,\n\tblockedunary7d,\n\tblockedunary8d,\n\tblockedunary9d,\n\tblockedunary10d // 8\n];\nvar BLOCKED_ACCESSOR_UNARY = [\n\tblockedaccessorunary2d, // 0\n\tblockedaccessorunary3d,\n\tblockedaccessorunary4d,\n\tblockedaccessorunary5d,\n\tblockedaccessorunary6d,\n\tblockedaccessorunary7d,\n\tblockedaccessorunary8d,\n\tblockedaccessorunary9d,\n\tblockedaccessorunary10d // 8\n];\nvar MAX_DIMS = UNARY.length - 1;\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an input ndarray and assigns results to elements in an output ndarray.\n*\n* ## Notes\n*\n* - Each provided ndarray should be an `object` with the following properties:\n*\n* - **dtype**: data type.\n* - **data**: data buffer.\n* - **shape**: dimensions.\n* - **strides**: stride lengths.\n* - **offset**: index offset.\n* - **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style).\n*\n* @param {ArrayLikeObject} arrays - array-like object containing one input array and one output array\n* @param {Callback} fcn - unary callback\n* @throws {Error} arrays must have the same number of dimensions\n* @throws {Error} arrays must have the same shape\n* @returns {void}\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary( [ x, y ], scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary( arrays, fcn ) {\n\tvar ndims;\n\tvar xmmv;\n\tvar ymmv;\n\tvar shx;\n\tvar shy;\n\tvar iox;\n\tvar ioy;\n\tvar len;\n\tvar ord;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ns;\n\tvar x;\n\tvar y;\n\tvar d;\n\tvar i;\n\n\t// Unpack the ndarrays and standardize ndarray meta data:\n\tx = ndarray2object( arrays[ 0 ] );\n\ty = ndarray2object( arrays[ 1 ] );\n\n\t// Verify that the input and output arrays have the same number of dimensions...\n\tshx = x.shape;\n\tshy = y.shape;\n\tndims = shx.length;\n\tif ( ndims !== shy.length ) {\n\t\tthrow new Error( format( 'invalid arguments. Arrays must have the same number of dimensions (i.e., same rank). ndims(x) == %d. ndims(y) == %d.', ndims, shy.length ) );\n\t}\n\t// Determine whether we can avoid iteration altogether...\n\tif ( ndims === 0 ) {\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn ACCESSOR_UNARY[ ndims ]( x, y, fcn );\n\t\t}\n\t\treturn UNARY[ ndims ]( x, y, fcn );\n\t}\n\t// Verify that the input and output arrays have the same dimensions...\n\tlen = 1; // number of elements\n\tns = 0; // number of singleton dimensions\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\td = shx[ i ];\n\t\tif ( d !== shy[ i ] ) {\n\t\t\tthrow new Error( 'invalid arguments. Arrays must have the same shape.' );\n\t\t}\n\t\t// Note that, if one of the dimensions is `0`, the length will be `0`...\n\t\tlen *= d;\n\n\t\t// Check whether the current dimension is a singleton dimension...\n\t\tif ( d === 1 ) {\n\t\t\tns += 1;\n\t\t}\n\t}\n\t// Check whether we were provided empty ndarrays...\n\tif ( len === 0 ) {\n\t\treturn;\n\t}\n\t// Determine whether the ndarrays are one-dimensional and thus readily translate to one-dimensional strided arrays...\n\tif ( ndims === 1 ) {\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn ACCESSOR_UNARY[ ndims ]( x, y, fcn );\n\t\t}\n\t\treturn UNARY[ ndims ]( x, y, fcn );\n\t}\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays...\n\tif ( ns === ndims-1 ) {\n\t\t// Get the index of the non-singleton dimension...\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\tif ( shx[ i ] !== 1 ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tx.shape = [ shx[i] ];\n\t\ty.shape = x.shape;\n\t\tx.strides = [ sx[i] ];\n\t\ty.strides = [ sy[i] ];\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn ACCESSOR_UNARY[ 1 ]( x, y, fcn );\n\t\t}\n\t\treturn UNARY[ 1 ]( x, y, fcn );\n\t}\n\tiox = iterationOrder( sx ); // +/-1\n\tioy = iterationOrder( sy ); // +/-1\n\n\t// Determine whether we can avoid blocked iteration...\n\tord = strides2order( sx );\n\tif ( iox !== 0 && ioy !== 0 && ord === strides2order( sy ) ) {\n\t\t// Determine the minimum and maximum linear indices which are accessible by the array views:\n\t\txmmv = minmaxViewBufferIndex( shx, sx, x.offset );\n\t\tymmv = minmaxViewBufferIndex( shy, sy, y.offset );\n\n\t\t// Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays...\n\t\tif ( len === ( xmmv[1]-xmmv[0]+1 ) && len === ( ymmv[1]-ymmv[0]+1 ) ) {\n\t\t\t// Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values...\n\t\t\tif ( iox === 1 ) {\n\t\t\t\tox = xmmv[ 0 ];\n\t\t\t} else {\n\t\t\t\tox = xmmv[ 1 ];\n\t\t\t}\n\t\t\tif ( ioy === 1 ) {\n\t\t\t\toy = ymmv[ 0 ];\n\t\t\t} else {\n\t\t\t\toy = ymmv[ 1 ];\n\t\t\t}\n\t\t\tx.shape = [ len ];\n\t\t\ty.shape = x.shape;\n\t\t\tx.strides = [ iox ];\n\t\t\ty.strides = [ ioy ];\n\t\t\tx.offset = ox;\n\t\t\ty.offset = oy;\n\t\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\t\treturn ACCESSOR_UNARY[ 1 ]( x, y, fcn );\n\t\t\t}\n\t\t\treturn UNARY[ 1 ]( x, y, fcn );\n\t\t}\n\t\t// At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality...\n\n\t\t// Determine whether we can use simple nested loops...\n\t\tif ( ndims <= MAX_DIMS ) {\n\t\t\t// So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration...\n\t\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\t\treturn ACCESSOR_UNARY[ ndims ]( x, y, ord, fcn );\n\t\t\t}\n\t\t\treturn UNARY[ ndims ]( x, y, ord, fcn );\n\t\t}\n\t\t// Fall-through to blocked iteration...\n\t}\n\t// At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration...\n\n\t// Determine whether we can perform blocked iteration...\n\tif ( ndims <= MAX_DIMS ) {\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn BLOCKED_ACCESSOR_UNARY[ ndims-2 ]( x, y, fcn );\n\t\t}\n\t\treturn BLOCKED_UNARY[ ndims-2 ]( x, y, fcn );\n\t}\n\t// Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)...\n\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\treturn accessorunarynd( x, y, fcn );\n\t}\n\tunarynd( x, y, fcn );\n}\n\n\n// EXPORTS //\n\nmodule.exports = unary;\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* Apply a unary callback to elements in an input ndarray and assign results to elements in an output ndarray.\n*\n* @module @stdlib/ndarray-base-unary\n*\n* @example\n* var Float64Array = require( '@stdlib/array-float64' );\n* var unary = require( '@stdlib/ndarray-base-unary' );\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary( [ x, y ], scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "wGAAA,IAAAA,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA8BJ,IAzBAA,EAAI9B,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7Ca,EAAKa,EAAE,GACPV,EAAKU,EAAE,GACPT,EAAKS,EAAE,GAGPxB,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCkB,EAAKnB,EAAE,OACPoB,EAAKnB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMS,EAAG,CAAC,EACVP,EAAMQ,EAAG,CAAC,EAGVZ,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGbyB,EAAKZ,EAAG,CAAC,EAAGY,EAAK,GAUtB,IATKA,EAAKvB,GACTa,EAAKU,EACLA,EAAK,IAELV,EAAKb,EACLuB,GAAMvB,GAEPS,EAAMO,EAAOO,EAAGT,EAAG,CAAC,EACpBJ,EAAMO,EAAOM,EAAGR,EAAG,CAAC,EACdO,EAAKX,EAAG,CAAC,EAAGW,EAAK,GAiBtB,IAhBKA,EAAKtB,GACTY,EAAKU,EACLA,EAAK,IAELV,EAAKZ,EACLsB,GAAMtB,GAGPkB,EAAKT,EAAQa,EAAGR,EAAG,CAAC,EACpBK,EAAKT,EAAQY,EAAGP,EAAG,CAAC,EAGpBT,EAAMQ,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBN,EAAMO,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EAGjBM,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IACtBhB,EAAKF,EAAMiB,EAAIpB,EAAKI,EAAKF,EAAMiB,CAAG,CAAE,CAAE,EACtCA,GAAMb,EACNc,GAAMZ,EAEPW,GAAMZ,EACNa,GAAMX,CACP,CAGH,CAKAf,GAAO,QAAUG,KCrNjB,IAAA6B,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA8BJ,IAzBAA,EAAIrC,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CiB,EAAKgB,EAAE,GACPZ,EAAKY,EAAE,GACPX,EAAKW,EAAE,GAGP/B,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCuB,EAAKxB,EAAE,OACPyB,EAAKxB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMc,EAAG,CAAC,EACVX,EAAMY,EAAG,CAAC,EAGVjB,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGbgC,EAAKf,EAAG,CAAC,EAAGe,EAAK,GAUtB,IATKA,EAAK9B,GACTkB,EAAKY,EACLA,EAAK,IAELZ,EAAKlB,EACL8B,GAAM9B,GAEPY,EAAMS,EAAOS,EAAGX,EAAG,CAAC,EACpBL,EAAMQ,EAAOQ,EAAGV,EAAG,CAAC,EACdS,EAAKd,EAAG,CAAC,EAAGc,EAAK,GAYtB,IAXKA,EAAK7B,GACTiB,EAAKY,EACLA,EAAK,IAELZ,EAAKjB,EACL6B,GAAM7B,GAEPO,EAAMY,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBT,EAAMU,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBT,EAAMC,EAAQiB,EAAGV,EAAG,CAAC,EACrBN,EAAMC,EAAQe,EAAGT,EAAG,CAAC,EACfQ,EAAKb,EAAG,CAAC,EAAGa,EAAK,GAiBtB,IAhBKA,EAAK5B,GACTgB,EAAKY,EACLA,EAAK,IAELZ,EAAKhB,EACL4B,GAAM5B,GAGPuB,EAAKZ,EAAQiB,EAAGT,EAAG,CAAC,EACpBK,EAAKX,EAAQe,EAAGR,EAAG,CAAC,EAGpBd,EAAMa,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBV,EAAMW,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EAGjBO,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IACtBrB,EAAKF,EAAMsB,EAAIzB,EAAKI,EAAKF,EAAMsB,CAAG,CAAE,CAAE,EACtCA,GAAMlB,EACNmB,GAAMhB,EAEPe,GAAMjB,EACNkB,GAAMf,CACP,CACAc,GAAMhB,EACNiB,GAAMd,CACP,CAIJ,CAKAjB,GAAO,QAAUG,KC/OjB,IAAAoC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA8BJ,IAzBAA,EAAI5C,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CqB,EAAKmB,EAAE,GACPd,EAAKc,EAAE,GACPb,EAAKa,EAAE,GAGPtC,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpC4B,EAAK7B,EAAE,OACP8B,EAAK7B,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMmB,EAAG,CAAC,EACVf,EAAMgB,EAAG,CAAC,EAGVtB,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGbuC,EAAKlB,EAAG,CAAC,EAAGkB,EAAK,GAUtB,IATKA,EAAKrC,GACTuB,EAAKc,EACLA,EAAK,IAELd,EAAKvB,EACLqC,GAAMrC,GAEPe,EAAMW,EAAOW,EAAGb,EAAG,CAAC,EACpBN,EAAMS,EAAOU,EAAGZ,EAAG,CAAC,EACdW,EAAKjB,EAAG,CAAC,EAAGiB,EAAK,GAYtB,IAXKA,EAAKpC,GACTsB,EAAKc,EACLA,EAAK,IAELd,EAAKtB,EACLoC,GAAMpC,GAEPQ,EAAMgB,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBZ,EAAMa,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBX,EAAMC,EAAQqB,EAAGZ,EAAG,CAAC,EACrBP,EAAMC,EAAQkB,EAAGX,EAAG,CAAC,EACfU,EAAKhB,EAAG,CAAC,EAAGgB,EAAK,GAYtB,IAXKA,EAAKnC,GACTqB,EAAKc,EACLA,EAAK,IAELd,EAAKrB,EACLmC,GAAMnC,GAEPO,EAAMiB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBb,EAAMc,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBZ,EAAMC,EAAQqB,EAAGX,EAAG,CAAC,EACrBR,EAAMC,EAAQkB,EAAGV,EAAG,CAAC,EACfS,EAAKf,EAAG,CAAC,EAAGe,EAAK,GAiBtB,IAhBKA,EAAKlC,GACToB,EAAKc,EACLA,EAAK,IAELd,EAAKpB,EACLkC,GAAMlC,GAGP4B,EAAKf,EAAQqB,EAAGV,EAAG,CAAC,EACpBK,EAAKb,EAAQkB,EAAGT,EAAG,CAAC,EAGpBnB,EAAMkB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBd,EAAMe,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EAGjBQ,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IACtB1B,EAAKF,EAAM2B,EAAI9B,EAAKI,EAAKF,EAAM2B,CAAG,CAAE,CAAE,EACtCA,GAAMvB,EACNwB,GAAMpB,EAEPmB,GAAMtB,EACNuB,GAAMnB,CACP,CACAkB,GAAMrB,EACNsB,GAAMlB,CACP,CACAiB,GAAMpB,EACNqB,GAAMjB,CACP,CAKL,CAKAnB,GAAO,QAAUG,KCvQjB,IAAA2C,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA8BJ,IAzBAA,EAAInD,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CyB,EAAKsB,EAAE,GACPhB,EAAKgB,EAAE,GACPf,EAAKe,EAAE,GAGP7C,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCiC,EAAKlC,EAAE,OACPmC,EAAKlC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMwB,EAAG,CAAC,EACVnB,EAAMoB,EAAG,CAAC,EAGV3B,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGb8C,EAAKrB,EAAG,CAAC,EAAGqB,EAAK,GAUtB,IATKA,EAAK5C,GACT4B,EAAKgB,EACLA,EAAK,IAELhB,EAAK5B,EACL4C,GAAM5C,GAEPkB,EAAMa,EAAOa,EAAGf,EAAG,CAAC,EACpBP,EAAMU,EAAOY,EAAGd,EAAG,CAAC,EACda,EAAKpB,EAAG,CAAC,EAAGoB,EAAK,GAYtB,IAXKA,EAAK3C,GACT2B,EAAKgB,EACLA,EAAK,IAELhB,EAAK3B,EACL2C,GAAM3C,GAEPS,EAAMoB,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBf,EAAMgB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBb,EAAMC,EAAQyB,EAAGd,EAAG,CAAC,EACrBR,EAAMC,EAAQqB,EAAGb,EAAG,CAAC,EACfY,EAAKnB,EAAG,CAAC,EAAGmB,EAAK,GAYtB,IAXKA,EAAK1C,GACT0B,EAAKgB,EACLA,EAAK,IAELhB,EAAK1B,EACL0C,GAAM1C,GAEPQ,EAAMqB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBhB,EAAMiB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBd,EAAMC,EAAQyB,EAAGb,EAAG,CAAC,EACrBT,EAAMC,EAAQqB,EAAGZ,EAAG,CAAC,EACfW,EAAKlB,EAAG,CAAC,EAAGkB,EAAK,GAYtB,IAXKA,EAAKzC,GACTyB,EAAKgB,EACLA,EAAK,IAELhB,EAAKzB,EACLyC,GAAMzC,GAEPO,EAAMsB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBjB,EAAMkB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBf,EAAMC,EAAQyB,EAAGZ,EAAG,CAAC,EACrBV,EAAMC,EAAQqB,EAAGX,EAAG,CAAC,EACfU,EAAKjB,EAAG,CAAC,EAAGiB,EAAK,GAiBtB,IAhBKA,EAAKxC,GACTwB,EAAKgB,EACLA,EAAK,IAELhB,EAAKxB,EACLwC,GAAMxC,GAGPiC,EAAKlB,EAAQyB,EAAGX,EAAG,CAAC,EACpBK,EAAKf,EAAQqB,EAAGV,EAAG,CAAC,EAGpBxB,EAAMuB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBlB,EAAMmB,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EAGjBS,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IACtB/B,EAAKF,EAAMgC,EAAInC,EAAKI,EAAKF,EAAMgC,CAAG,CAAE,CAAE,EACtCA,GAAM5B,EACN6B,GAAMxB,EAEPuB,GAAM3B,EACN4B,GAAMvB,CACP,CACAsB,GAAM1B,EACN2B,GAAMtB,CACP,CACAqB,GAAMzB,EACN0B,GAAMrB,CACP,CACAoB,GAAMxB,EACNyB,GAAMpB,CACP,CAMN,CAKArB,GAAO,QAAUG,KC/RjB,IAAAkD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EA8BJ,IAzBAA,EAAI1D,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7C6B,EAAKyB,EAAE,GACPlB,EAAKkB,EAAE,GACPjB,EAAKiB,EAAE,GAGPpD,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCsC,EAAKvC,EAAE,OACPwC,EAAKvC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAM6B,EAAG,CAAC,EACVvB,EAAMwB,EAAG,CAAC,EAGVhC,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGbqD,GAAKxB,EAAG,CAAC,EAAGwB,GAAK,GAUtB,IATKA,GAAKnD,GACTiC,EAAKkB,GACLA,GAAK,IAELlB,EAAKjC,EACLmD,IAAMnD,GAEPqB,EAAMe,EAAOe,GAAGjB,EAAG,CAAC,EACpBR,EAAMW,EAAOc,GAAGhB,EAAG,CAAC,EACde,EAAKvB,EAAG,CAAC,EAAGuB,EAAK,GAYtB,IAXKA,EAAKlD,GACTgC,EAAKkB,EACLA,EAAK,IAELlB,EAAKhC,EACLkD,GAAMlD,GAEPU,EAAMwB,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBlB,EAAMmB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBf,EAAMC,EAAQ6B,EAAGhB,EAAG,CAAC,EACrBT,EAAMC,EAAQwB,EAAGf,EAAG,CAAC,EACfc,EAAKtB,EAAG,CAAC,EAAGsB,EAAK,GAYtB,IAXKA,EAAKjD,GACT+B,EAAKkB,EACLA,EAAK,IAELlB,EAAK/B,EACLiD,GAAMjD,GAEPS,EAAMyB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBnB,EAAMoB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBhB,EAAMC,EAAQ6B,EAAGf,EAAG,CAAC,EACrBV,EAAMC,EAAQwB,EAAGd,EAAG,CAAC,EACfa,EAAKrB,EAAG,CAAC,EAAGqB,EAAK,GAYtB,IAXKA,EAAKhD,GACT8B,EAAKkB,EACLA,EAAK,IAELlB,EAAK9B,EACLgD,GAAMhD,GAEPQ,EAAM0B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBpB,EAAMqB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBjB,EAAMC,EAAQ6B,EAAGd,EAAG,CAAC,EACrBX,EAAMC,EAAQwB,EAAGb,EAAG,CAAC,EACfY,EAAKpB,EAAG,CAAC,EAAGoB,EAAK,GAYtB,IAXKA,EAAK/C,GACT6B,EAAKkB,EACLA,EAAK,IAELlB,EAAK7B,EACL+C,GAAM/C,GAEPO,EAAM2B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBrB,EAAMsB,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBlB,EAAMC,EAAQ6B,EAAGb,EAAG,CAAC,EACrBZ,EAAMC,EAAQwB,EAAGZ,EAAG,CAAC,EACfW,GAAKnB,EAAG,CAAC,EAAGmB,GAAK,GAiBtB,IAhBKA,GAAK9C,GACT4B,EAAKkB,GACLA,GAAK,IAELlB,EAAK5B,EACL8C,IAAM9C,GAGPsC,EAAKrB,EAAQ6B,GAAGZ,EAAG,CAAC,EACpBK,EAAKjB,EAAQwB,GAAGX,EAAG,CAAC,EAGpB7B,EAAM4B,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBtB,EAAMuB,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EAGjBU,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IACtBpC,EAAKF,EAAMqC,EAAIxC,EAAKI,EAAKF,EAAMqC,CAAG,CAAE,CAAE,EACtCA,GAAMjC,EACNkC,GAAM5B,EAEP2B,GAAMhC,EACNiC,GAAM3B,CACP,CACA0B,GAAM/B,EACNgC,GAAM1B,CACP,CACAyB,GAAM9B,EACN+B,GAAMzB,CACP,CACAwB,GAAM7B,EACN8B,GAAMxB,CACP,CACAuB,GAAM5B,EACN6B,GAAMvB,CACP,CAOP,CAKAvB,GAAO,QAAUG,KCvTjB,IAAAyD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA8BJ,IAzBAA,GAAIjE,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CiC,EAAK4B,GAAE,GACPpB,EAAKoB,GAAE,GACPnB,EAAKmB,GAAE,GAGP3D,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpC2C,EAAK5C,EAAE,OACP6C,EAAK5C,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMkC,EAAG,CAAC,EACV3B,EAAM4B,EAAG,CAAC,EAGVrC,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGb4D,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAUtB,IATKA,GAAK1D,GACTsC,EAAKoB,GACLA,GAAK,IAELpB,EAAKtC,EACL0D,IAAM1D,GAEPwB,EAAMiB,EAAOiB,GAAGnB,EAAG,CAAC,EACpBT,EAAMY,EAAOgB,GAAGlB,EAAG,CAAC,EACdiB,GAAK1B,EAAG,CAAC,EAAG0B,GAAK,GAYtB,IAXKA,GAAKzD,GACTqC,EAAKoB,GACLA,GAAK,IAELpB,EAAKrC,EACLyD,IAAMzD,GAEPW,EAAM4B,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBrB,EAAMsB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBjB,EAAMC,EAAQiC,GAAGlB,EAAG,CAAC,EACrBV,EAAMC,EAAQ2B,GAAGjB,EAAG,CAAC,EACfgB,GAAKzB,EAAG,CAAC,EAAGyB,GAAK,GAYtB,IAXKA,GAAKxD,GACToC,EAAKoB,GACLA,GAAK,IAELpB,EAAKpC,EACLwD,IAAMxD,GAEPU,EAAM6B,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBtB,EAAMuB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBlB,EAAMC,EAAQiC,GAAGjB,EAAG,CAAC,EACrBX,EAAMC,EAAQ2B,GAAGhB,EAAG,CAAC,EACfe,GAAKxB,EAAG,CAAC,EAAGwB,GAAK,GAYtB,IAXKA,GAAKvD,GACTmC,EAAKoB,GACLA,GAAK,IAELpB,EAAKnC,EACLuD,IAAMvD,GAEPS,EAAM8B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBvB,EAAMwB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBnB,EAAMC,EAAQiC,GAAGhB,EAAG,CAAC,EACrBZ,EAAMC,EAAQ2B,GAAGf,EAAG,CAAC,EACfc,GAAKvB,EAAG,CAAC,EAAGuB,GAAK,GAYtB,IAXKA,GAAKtD,GACTkC,EAAKoB,GACLA,GAAK,IAELpB,EAAKlC,EACLsD,IAAMtD,GAEPQ,EAAM+B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBxB,EAAMyB,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBpB,EAAMC,EAAQiC,GAAGf,EAAG,CAAC,EACrBb,EAAMC,EAAQ2B,GAAGd,EAAG,CAAC,EACfa,GAAKtB,EAAG,CAAC,EAAGsB,GAAK,GAYtB,IAXKA,GAAKrD,GACTiC,EAAKoB,GACLA,GAAK,IAELpB,EAAKjC,EACLqD,IAAMrD,GAEPO,EAAMgC,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBzB,EAAM0B,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBrB,EAAMC,EAAQiC,GAAGd,EAAG,CAAC,EACrBd,EAAMC,EAAQ2B,GAAGb,EAAG,CAAC,EACfY,EAAKrB,EAAG,CAAC,EAAGqB,EAAK,GAiBtB,IAhBKA,EAAKpD,GACTgC,EAAKoB,EACLA,EAAK,IAELpB,EAAKhC,EACLoD,GAAMpD,GAGP2C,EAAKxB,EAAQiC,EAAGb,EAAG,CAAC,EACpBK,EAAKnB,EAAQ2B,EAAGZ,EAAG,CAAC,EAGpBlC,EAAMiC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvB1B,EAAM2B,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EAGjBW,GAAK,EAAGA,GAAKb,EAAIa,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKb,EAAIa,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IACtBzC,EAAKF,EAAM0C,EAAI7C,EAAKI,EAAKF,EAAM0C,CAAG,CAAE,CAAE,EACtCA,GAAMtC,EACNuC,GAAMhC,EAEP+B,GAAMrC,EACNsC,GAAM/B,CACP,CACA8B,GAAMpC,EACNqC,GAAM9B,CACP,CACA6B,GAAMnC,EACNoC,GAAM7B,CACP,CACA4B,GAAMlC,EACNmC,GAAM5B,CACP,CACA2B,GAAMjC,EACNkC,GAAM3B,CACP,CACA0B,GAAMhC,EACNiC,GAAM1B,CACP,CAQR,CAKAzB,GAAO,QAAUG,KC/UjB,IAAAgE,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA8BJ,IAzBAA,GAAIxE,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CqC,EAAK+B,GAAE,GACPtB,EAAKsB,GAAE,GACPrB,EAAKqB,GAAE,GAGPlE,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCgD,GAAKjD,EAAE,OACPkD,EAAKjD,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMuC,EAAG,CAAC,EACV/B,EAAMgC,EAAG,CAAC,EAGV1C,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGbmE,GAAK9B,EAAG,CAAC,EAAG8B,GAAK,GAUtB,IATKA,GAAKjE,GACT2C,EAAKsB,GACLA,GAAK,IAELtB,EAAK3C,EACLiE,IAAMjE,GAEP2B,EAAMmB,GAAOmB,GAAGrB,EAAG,CAAC,EACpBV,EAAMa,EAAOkB,GAAGpB,EAAG,CAAC,EACdmB,GAAK7B,EAAG,CAAC,EAAG6B,GAAK,GAYtB,IAXKA,GAAKhE,GACT0C,EAAKsB,GACLA,GAAK,IAELtB,EAAK1C,EACLgE,IAAMhE,GAEPY,EAAMgC,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBxB,EAAMyB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBnB,EAAMC,EAAQqC,GAAGpB,EAAG,CAAC,EACrBX,EAAMC,EAAQ8B,GAAGnB,EAAG,CAAC,EACfkB,GAAK5B,EAAG,CAAC,EAAG4B,GAAK,GAYtB,IAXKA,GAAK/D,GACTyC,EAAKsB,GACLA,GAAK,IAELtB,EAAKzC,EACL+D,IAAM/D,GAEPW,EAAMiC,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBzB,EAAM0B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBpB,EAAMC,EAAQqC,GAAGnB,EAAG,CAAC,EACrBZ,EAAMC,EAAQ8B,GAAGlB,EAAG,CAAC,EACfiB,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAYtB,IAXKA,GAAK9D,GACTwC,EAAKsB,GACLA,GAAK,IAELtB,EAAKxC,EACL8D,IAAM9D,GAEPU,EAAMkC,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvB1B,EAAM2B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBrB,EAAMC,EAAQqC,GAAGlB,EAAG,CAAC,EACrBb,EAAMC,EAAQ8B,GAAGjB,EAAG,CAAC,EACfgB,GAAK1B,EAAG,CAAC,EAAG0B,GAAK,GAYtB,IAXKA,GAAK7D,GACTuC,EAAKsB,GACLA,GAAK,IAELtB,EAAKvC,EACL6D,IAAM7D,GAEPS,EAAMmC,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvB3B,EAAM4B,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBtB,EAAMC,EAAQqC,GAAGjB,EAAG,CAAC,EACrBd,EAAMC,EAAQ8B,GAAGhB,EAAG,CAAC,EACfe,GAAKzB,EAAG,CAAC,EAAGyB,GAAK,GAYtB,IAXKA,GAAK5D,GACTsC,EAAKsB,GACLA,GAAK,IAELtB,EAAKtC,EACL4D,IAAM5D,GAEPQ,EAAMoC,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvB5B,EAAM6B,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBvB,EAAMC,EAAQqC,GAAGhB,EAAG,CAAC,EACrBf,EAAMC,EAAQ8B,GAAGf,EAAG,CAAC,EACfc,GAAKxB,EAAG,CAAC,EAAGwB,GAAK,GAYtB,IAXKA,GAAK3D,GACTqC,EAAKsB,GACLA,GAAK,IAELtB,EAAKrC,EACL2D,IAAM3D,GAEPO,EAAMqC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvB7B,EAAM8B,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvBxB,EAAMC,EAAQqC,GAAGf,EAAG,CAAC,EACrBhB,EAAMC,EAAQ8B,GAAGd,EAAG,CAAC,EACfa,GAAKvB,EAAG,CAAC,EAAGuB,GAAK,GAiBtB,IAhBKA,GAAK1D,GACToC,EAAKsB,GACLA,GAAK,IAELtB,EAAKpC,EACL0D,IAAM1D,GAGPgD,EAAK3B,EAAQqC,GAAGd,EAAG,CAAC,EACpBK,EAAKrB,EAAQ8B,GAAGb,EAAG,CAAC,EAGpBvC,EAAMsC,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvB9B,EAAM+B,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EAGjBY,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IACtB9C,EAAKF,EAAM+C,EAAIlD,EAAKI,EAAKF,EAAM+C,CAAG,CAAE,CAAE,EACtCA,GAAM3C,EACN4C,GAAMpC,EAEPmC,GAAM1C,EACN2C,GAAMnC,CACP,CACAkC,GAAMzC,EACN0C,GAAMlC,CACP,CACAiC,GAAMxC,EACNyC,GAAMjC,CACP,CACAgC,GAAMvC,EACNwC,GAAMhC,CACP,CACA+B,GAAMtC,EACNuC,GAAM/B,CACP,CACA8B,GAAMrC,EACNsC,GAAM9B,CACP,CACA6B,GAAMpC,EACNqC,GAAM7B,CACP,CAST,CAKA3B,GAAO,QAAUG,KCvWjB,IAAAuE,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA8BJ,IAzBAA,GAAI/E,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CyC,EAAKkC,GAAE,GACPxB,EAAKwB,GAAE,GACPvB,EAAKuB,GAAE,GAGPzE,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCqD,GAAKtD,EAAE,OACPuD,EAAKtD,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAM4C,EAAG,CAAC,EACVnC,EAAMoC,EAAG,CAAC,EAGV/C,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGb0E,GAAKjC,EAAG,CAAC,EAAGiC,GAAK,GAUtB,IATKA,GAAKxE,GACTgD,EAAKwB,GACLA,GAAK,IAELxB,EAAKhD,EACLwE,IAAMxE,GAEP8B,EAAMqB,GAAOqB,GAAGvB,EAAG,CAAC,EACpBX,EAAMc,EAAOoB,GAAGtB,EAAG,CAAC,EACdqB,GAAKhC,EAAG,CAAC,EAAGgC,GAAK,GAYtB,IAXKA,GAAKvE,GACT+C,EAAKwB,GACLA,GAAK,IAELxB,EAAK/C,EACLuE,IAAMvE,GAEPa,EAAMoC,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvB3B,EAAM4B,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBrB,EAAMC,EAAQyC,GAAGtB,EAAG,CAAC,EACrBZ,EAAMC,EAAQiC,GAAGrB,EAAG,CAAC,EACfoB,GAAK/B,EAAG,CAAC,EAAG+B,GAAK,GAYtB,IAXKA,GAAKtE,GACT8C,GAAKwB,GACLA,GAAK,IAELxB,GAAK9C,EACLsE,IAAMtE,GAEPY,EAAMqC,EAAG,CAAC,EAAMH,GAAGG,EAAG,CAAC,EACvB5B,EAAM6B,EAAG,CAAC,EAAMJ,GAAGI,EAAG,CAAC,EACvBtB,EAAMC,EAAQyC,GAAGrB,EAAG,CAAC,EACrBb,EAAMC,EAAQiC,GAAGpB,EAAG,CAAC,EACfmB,GAAK9B,EAAG,CAAC,EAAG8B,GAAK,GAYtB,IAXKA,GAAKrE,GACT6C,EAAKwB,GACLA,GAAK,IAELxB,EAAK7C,EACLqE,IAAMrE,GAEPW,EAAMsC,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvB7B,EAAM8B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBvB,EAAMC,EAAQyC,GAAGpB,EAAG,CAAC,EACrBd,EAAMC,EAAQiC,GAAGnB,EAAG,CAAC,EACfkB,GAAK7B,EAAG,CAAC,EAAG6B,GAAK,GAYtB,IAXKA,GAAKpE,GACT4C,EAAKwB,GACLA,GAAK,IAELxB,EAAK5C,EACLoE,IAAMpE,GAEPU,EAAMuC,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvB9B,EAAM+B,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBxB,EAAMC,EAAQyC,GAAGnB,EAAG,CAAC,EACrBf,EAAMC,EAAQiC,GAAGlB,EAAG,CAAC,EACfiB,GAAK5B,EAAG,CAAC,EAAG4B,GAAK,GAYtB,IAXKA,GAAKnE,GACT2C,EAAKwB,GACLA,GAAK,IAELxB,EAAK3C,EACLmE,IAAMnE,GAEPS,EAAMwC,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvB/B,EAAMgC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBzB,EAAMC,EAAQyC,GAAGlB,EAAG,CAAC,EACrBhB,EAAMC,EAAQiC,GAAGjB,EAAG,CAAC,EACfgB,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAYtB,IAXKA,GAAKlE,GACT0C,EAAKwB,GACLA,GAAK,IAELxB,EAAK1C,EACLkE,IAAMlE,GAEPQ,EAAMyC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBhC,EAAMiC,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvB1B,EAAMC,EAAQyC,GAAGjB,EAAG,CAAC,EACrBjB,EAAMC,EAAQiC,GAAGhB,EAAG,CAAC,EACfe,GAAK1B,EAAG,CAAC,EAAG0B,GAAK,GAYtB,IAXKA,GAAKjE,GACTyC,EAAKwB,GACLA,GAAK,IAELxB,EAAKzC,EACLiE,IAAMjE,GAEPO,EAAM0C,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvBjC,EAAMkC,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EACvB3B,EAAMC,EAAQyC,GAAGhB,EAAG,CAAC,EACrBlB,EAAMC,EAAQiC,GAAGf,EAAG,CAAC,EACfc,GAAKzB,EAAG,CAAC,EAAGyB,GAAK,GAiBtB,IAhBKA,GAAKhE,GACTwC,EAAKwB,GACLA,GAAK,IAELxB,EAAKxC,EACLgE,IAAMhE,GAGPqD,GAAK9B,EAAQyC,GAAGf,EAAG,CAAC,EACpBK,GAAKvB,EAAQiC,GAAGd,EAAG,CAAC,EAGpB5C,EAAM2C,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EACvBlC,EAAMmC,EAAG,CAAC,EAAMV,EAAGU,EAAG,CAAC,EAGjBa,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,GAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KACtBnD,EAAKF,EAAMoD,GAAIvD,EAAKI,EAAKF,EAAMoD,EAAG,CAAE,CAAE,EACtCA,IAAMhD,EACNiD,IAAMxC,EAEPuC,IAAM/C,EACNgD,IAAMvC,CACP,CACAsC,IAAM9C,EACN+C,IAAMtC,CACP,CACAqC,IAAM7C,EACN8C,IAAMrC,CACP,CACAoC,IAAM5C,EACN6C,IAAMpC,CACP,CACAmC,IAAM3C,EACN4C,IAAMnC,CACP,CACAkC,IAAM1C,EACN2C,IAAMlC,CACP,CACAiC,IAAMzC,EACN0C,IAAMjC,CACP,CACAgC,IAAMxC,EACNyC,IAAMhC,CACP,CAUV,CAKA7B,GAAO,QAAUG,KC/XjB,IAAA8E,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EA4FxE,SAASC,GAAiBC,EAAGC,EAAGC,EAAM,CACrC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA8BJ,IAzBAA,GAAItF,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7C6C,EAAKqC,GAAE,GACP1B,GAAK0B,GAAE,GACPzB,GAAKyB,GAAE,GAGPhF,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpC0D,GAAK3D,EAAE,OACP4D,GAAK3D,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTO,EAAMiD,GAAG,CAAC,EACVvC,EAAMwC,GAAG,CAAC,EAGVpD,EAAMN,EAAE,UAAU,CAAC,EACnBO,EAAMN,EAAE,UAAU,CAAC,EAGbiF,GAAKpC,EAAG,CAAC,EAAGoC,GAAK,GAUtB,IATKA,GAAK/E,GACTqD,GAAK0B,GACLA,GAAK,IAEL1B,GAAKrD,EACL+E,IAAM/E,GAEPiC,EAAMuB,GAAOuB,GAAGzB,GAAG,CAAC,EACpBZ,EAAMe,GAAOsB,GAAGxB,GAAG,CAAC,EACduB,GAAKnC,EAAG,CAAC,EAAGmC,GAAK,GAYtB,IAXKA,GAAK9E,GACToD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKpD,EACL8E,IAAM9E,GAEPc,EAAMwC,GAAG,CAAC,EAAMF,EAAGE,GAAG,CAAC,EACvB9B,EAAM+B,GAAG,CAAC,EAAMH,EAAGG,GAAG,CAAC,EACvBvB,EAAMC,EAAQ6C,GAAGxB,GAAG,CAAC,EACrBb,EAAMC,EAAQoC,GAAGvB,GAAG,CAAC,EACfsB,GAAKlC,EAAG,CAAC,EAAGkC,GAAK,GAYtB,IAXKA,GAAK7E,GACTmD,GAAK0B,GACLA,GAAK,IAEL1B,GAAKnD,EACL6E,IAAM7E,GAEPa,EAAMyC,GAAG,CAAC,EAAMH,GAAGG,GAAG,CAAC,EACvB/B,EAAMgC,GAAG,CAAC,EAAMJ,GAAGI,GAAG,CAAC,EACvBxB,EAAMC,EAAQ6C,GAAGvB,GAAG,CAAC,EACrBd,EAAMC,EAAQoC,GAAGtB,GAAG,CAAC,EACfqB,GAAKjC,EAAG,CAAC,EAAGiC,GAAK,GAYtB,IAXKA,GAAK5E,GACTkD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKlD,EACL4E,IAAM5E,GAEPY,EAAM0C,GAAG,CAAC,EAAMJ,EAAGI,GAAG,CAAC,EACvBhC,EAAMiC,GAAG,CAAC,EAAML,EAAGK,GAAG,CAAC,EACvBzB,EAAMC,EAAQ6C,GAAGtB,GAAG,CAAC,EACrBf,EAAMC,EAAQoC,GAAGrB,GAAG,CAAC,EACfoB,GAAKhC,EAAG,CAAC,EAAGgC,GAAK,GAYtB,IAXKA,GAAK3E,GACTiD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKjD,EACL2E,IAAM3E,GAEPW,EAAM2C,GAAG,CAAC,EAAML,EAAGK,GAAG,CAAC,EACvBjC,EAAMkC,GAAG,CAAC,EAAMN,EAAGM,GAAG,CAAC,EACvB1B,EAAMC,EAAQ6C,GAAGrB,GAAG,CAAC,EACrBhB,EAAMC,EAAQoC,GAAGpB,GAAG,CAAC,EACfmB,GAAK/B,EAAG,CAAC,EAAG+B,GAAK,GAYtB,IAXKA,GAAK1E,GACTgD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKhD,EACL0E,IAAM1E,GAEPU,EAAM4C,GAAG,CAAC,EAAMN,EAAGM,GAAG,CAAC,EACvBlC,EAAMmC,GAAG,CAAC,EAAMP,EAAGO,GAAG,CAAC,EACvB3B,EAAMC,EAAQ6C,GAAGpB,GAAG,CAAC,EACrBjB,EAAMC,EAAQoC,GAAGnB,GAAG,CAAC,EACfkB,GAAK9B,EAAG,CAAC,EAAG8B,GAAK,GAYtB,IAXKA,GAAKzE,GACT+C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK/C,EACLyE,IAAMzE,GAEPS,EAAM6C,GAAG,CAAC,EAAMP,EAAGO,GAAG,CAAC,EACvBnC,EAAMoC,GAAG,CAAC,EAAMR,EAAGQ,GAAG,CAAC,EACvB5B,EAAMC,EAAQ6C,GAAGnB,GAAG,CAAC,EACrBlB,EAAMC,EAAQoC,GAAGlB,GAAG,CAAC,EACfiB,GAAK7B,EAAG,CAAC,EAAG6B,GAAK,GAYtB,IAXKA,GAAKxE,GACT8C,GAAK0B,GACLA,GAAK,IAEL1B,GAAK9C,EACLwE,IAAMxE,GAEPQ,EAAM8C,GAAG,CAAC,EAAMR,GAAGQ,GAAG,CAAC,EACvBpC,EAAMqC,GAAG,CAAC,EAAMT,GAAGS,GAAG,CAAC,EACvB7B,EAAMC,EAAQ6C,GAAGlB,GAAG,CAAC,EACrBnB,EAAMC,EAAQoC,GAAGjB,GAAG,CAAC,EACfgB,GAAK5B,EAAG,CAAC,EAAG4B,GAAK,GAYtB,IAXKA,GAAKvE,GACT6C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK7C,EACLuE,IAAMvE,GAEPO,EAAM+C,GAAG,CAAC,EAAMT,EAAGS,GAAG,CAAC,EACvBrC,EAAMsC,GAAG,CAAC,EAAMV,EAAGU,GAAG,CAAC,EACvB9B,EAAMC,EAAQ6C,GAAGjB,GAAG,CAAC,EACrBpB,EAAMC,EAAQoC,GAAGhB,GAAG,CAAC,EACfe,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAiBtB,IAhBKA,GAAKtE,GACT4C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK5C,EACLsE,IAAMtE,GAGP0D,GAAKjC,EAAQ6C,GAAGhB,GAAG,CAAC,EACpBK,GAAKzB,EAAQoC,GAAGf,GAAG,CAAC,EAGpBjD,EAAMgD,GAAG,CAAC,EAAMV,EAAGU,GAAG,CAAC,EACvBtC,EAAMuC,GAAG,CAAC,EAAMX,EAAGW,GAAG,CAAC,EAGjBc,GAAK,EAAGA,GAAKhB,GAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,GAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,GAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KACtBxD,EAAKF,EAAMyD,GAAI5D,EAAKI,EAAKF,EAAMyD,EAAG,CAAE,CAAE,EACtCA,IAAMrD,EACNsD,IAAM5C,EAEP2C,IAAMpD,EACNqD,IAAM3C,CACP,CACA0C,IAAMnD,EACNoD,IAAM1C,CACP,CACAyC,IAAMlD,EACNmD,IAAMzC,CACP,CACAwC,IAAMjD,EACNkD,IAAMxC,CACP,CACAuC,IAAMhD,EACNiD,IAAMvC,CACP,CACAsC,IAAM/C,EACNgD,IAAMtC,CACP,CACAqC,IAAM9C,EACN+C,IAAMrC,CACP,CACAoC,IAAM7C,EACN8C,IAAMpC,CACP,CACAmC,IAAM5C,EACN6C,IAAMnC,CACP,CAWX,CAKA/B,GAAO,QAAUG,KCvZjB,IAAAqF,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA0BJ,IArBAA,EAAI5B,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CW,EAAKa,EAAE,GACPV,EAAKU,EAAE,GACPT,EAAKS,EAAE,GAGPtB,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCgB,EAAKjB,EAAE,OACPkB,EAAKjB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMS,EAAG,CAAC,EACVP,EAAMQ,EAAG,CAAC,EAGJQ,EAAKZ,EAAG,CAAC,EAAGY,EAAK,GAUtB,IATKA,EAAKrB,GACTW,EAAKU,EACLA,EAAK,IAELV,EAAKX,EACLqB,GAAMrB,GAEPO,EAAMO,EAAOO,EAAGT,EAAG,CAAC,EACpBJ,EAAMO,EAAOM,EAAGR,EAAG,CAAC,EACdO,EAAKX,EAAG,CAAC,EAAGW,EAAK,GAiBtB,IAhBKA,EAAKpB,GACTU,EAAKU,EACLA,EAAK,IAELV,EAAKV,EACLoB,GAAMpB,GAGPgB,EAAKT,EAAQa,EAAGR,EAAG,CAAC,EACpBK,EAAKT,EAAQY,EAAGP,EAAG,CAAC,EAGpBT,EAAMQ,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBN,EAAMO,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EAGjBM,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IACtBhB,EAAMe,CAAG,EAAIlB,EAAKE,EAAMe,CAAG,CAAE,EAC7BA,GAAMb,EACNc,GAAMZ,EAEPW,GAAMZ,EACNa,GAAMX,CACP,CAGH,CAKAb,GAAO,QAAUG,KC1LjB,IAAA2B,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA0BJ,IArBAA,EAAInC,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7Ce,EAAKgB,EAAE,GACPZ,EAAKY,EAAE,GACPX,EAAKW,EAAE,GAGP7B,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCqB,EAAKtB,EAAE,OACPuB,EAAKtB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMc,EAAG,CAAC,EACVX,EAAMY,EAAG,CAAC,EAGJU,EAAKf,EAAG,CAAC,EAAGe,EAAK,GAUtB,IATKA,EAAK5B,GACTgB,EAAKY,EACLA,EAAK,IAELZ,EAAKhB,EACL4B,GAAM5B,GAEPU,EAAMS,EAAOS,EAAGX,EAAG,CAAC,EACpBL,EAAMQ,EAAOQ,EAAGV,EAAG,CAAC,EACdS,EAAKd,EAAG,CAAC,EAAGc,EAAK,GAYtB,IAXKA,EAAK3B,GACTe,EAAKY,EACLA,EAAK,IAELZ,EAAKf,EACL2B,GAAM3B,GAEPK,EAAMY,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBT,EAAMU,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBT,EAAMC,EAAQiB,EAAGV,EAAG,CAAC,EACrBN,EAAMC,EAAQe,EAAGT,EAAG,CAAC,EACfQ,EAAKb,EAAG,CAAC,EAAGa,EAAK,GAiBtB,IAhBKA,EAAK1B,GACTc,EAAKY,EACLA,EAAK,IAELZ,EAAKd,EACL0B,GAAM1B,GAGPqB,EAAKZ,EAAQiB,EAAGT,EAAG,CAAC,EACpBK,EAAKX,EAAQe,EAAGR,EAAG,CAAC,EAGpBd,EAAMa,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBV,EAAMW,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EAGjBO,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IACtBrB,EAAMoB,CAAG,EAAIvB,EAAKE,EAAMoB,CAAG,CAAE,EAC7BA,GAAMlB,EACNmB,GAAMhB,EAEPe,GAAMjB,EACNkB,GAAMf,CACP,CACAc,GAAMhB,EACNiB,GAAMd,CACP,CAIJ,CAKAf,GAAO,QAAUG,KCpNjB,IAAAkC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA0BJ,IArBAA,EAAI1C,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CmB,EAAKmB,EAAE,GACPd,EAAKc,EAAE,GACPb,EAAKa,EAAE,GAGPpC,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpC0B,EAAK3B,EAAE,OACP4B,EAAK3B,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMmB,EAAG,CAAC,EACVf,EAAMgB,EAAG,CAAC,EAGJY,EAAKlB,EAAG,CAAC,EAAGkB,EAAK,GAUtB,IATKA,EAAKnC,GACTqB,EAAKc,EACLA,EAAK,IAELd,EAAKrB,EACLmC,GAAMnC,GAEPa,EAAMW,EAAOW,EAAGb,EAAG,CAAC,EACpBN,EAAMS,EAAOU,EAAGZ,EAAG,CAAC,EACdW,EAAKjB,EAAG,CAAC,EAAGiB,EAAK,GAYtB,IAXKA,EAAKlC,GACToB,EAAKc,EACLA,EAAK,IAELd,EAAKpB,EACLkC,GAAMlC,GAEPM,EAAMgB,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBZ,EAAMa,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBX,EAAMC,EAAQqB,EAAGZ,EAAG,CAAC,EACrBP,EAAMC,EAAQkB,EAAGX,EAAG,CAAC,EACfU,EAAKhB,EAAG,CAAC,EAAGgB,EAAK,GAYtB,IAXKA,EAAKjC,GACTmB,EAAKc,EACLA,EAAK,IAELd,EAAKnB,EACLiC,GAAMjC,GAEPK,EAAMiB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBb,EAAMc,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBZ,EAAMC,EAAQqB,EAAGX,EAAG,CAAC,EACrBR,EAAMC,EAAQkB,EAAGV,EAAG,CAAC,EACfS,EAAKf,EAAG,CAAC,EAAGe,EAAK,GAiBtB,IAhBKA,EAAKhC,GACTkB,EAAKc,EACLA,EAAK,IAELd,EAAKlB,EACLgC,GAAMhC,GAGP0B,EAAKf,EAAQqB,EAAGV,EAAG,CAAC,EACpBK,EAAKb,EAAQkB,EAAGT,EAAG,CAAC,EAGpBnB,EAAMkB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBd,EAAMe,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EAGjBQ,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IACtB1B,EAAMyB,CAAG,EAAI5B,EAAKE,EAAMyB,CAAG,CAAE,EAC7BA,GAAMvB,EACNwB,GAAMpB,EAEPmB,GAAMtB,EACNuB,GAAMnB,CACP,CACAkB,GAAMrB,EACNsB,GAAMlB,CACP,CACAiB,GAAMpB,EACNqB,GAAMjB,CACP,CAKL,CAKAjB,GAAO,QAAUG,KC5OjB,IAAAyC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA0BJ,IArBAA,EAAIjD,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CuB,EAAKsB,EAAE,GACPhB,EAAKgB,EAAE,GACPf,EAAKe,EAAE,GAGP3C,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpC+B,EAAKhC,EAAE,OACPiC,EAAKhC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMwB,EAAG,CAAC,EACVnB,EAAMoB,EAAG,CAAC,EAGJc,EAAKrB,EAAG,CAAC,EAAGqB,EAAK,GAUtB,IATKA,EAAK1C,GACT0B,EAAKgB,EACLA,EAAK,IAELhB,EAAK1B,EACL0C,GAAM1C,GAEPgB,EAAMa,EAAOa,EAAGf,EAAG,CAAC,EACpBP,EAAMU,EAAOY,EAAGd,EAAG,CAAC,EACda,EAAKpB,EAAG,CAAC,EAAGoB,EAAK,GAYtB,IAXKA,EAAKzC,GACTyB,EAAKgB,EACLA,EAAK,IAELhB,EAAKzB,EACLyC,GAAMzC,GAEPO,EAAMoB,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBf,EAAMgB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBb,EAAMC,EAAQyB,EAAGd,EAAG,CAAC,EACrBR,EAAMC,EAAQqB,EAAGb,EAAG,CAAC,EACfY,EAAKnB,EAAG,CAAC,EAAGmB,EAAK,GAYtB,IAXKA,EAAKxC,GACTwB,EAAKgB,EACLA,EAAK,IAELhB,EAAKxB,EACLwC,GAAMxC,GAEPM,EAAMqB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBhB,EAAMiB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBd,EAAMC,EAAQyB,EAAGb,EAAG,CAAC,EACrBT,EAAMC,EAAQqB,EAAGZ,EAAG,CAAC,EACfW,EAAKlB,EAAG,CAAC,EAAGkB,EAAK,GAYtB,IAXKA,EAAKvC,GACTuB,EAAKgB,EACLA,EAAK,IAELhB,EAAKvB,EACLuC,GAAMvC,GAEPK,EAAMsB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBjB,EAAMkB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBf,EAAMC,EAAQyB,EAAGZ,EAAG,CAAC,EACrBV,EAAMC,EAAQqB,EAAGX,EAAG,CAAC,EACfU,EAAKjB,EAAG,CAAC,EAAGiB,EAAK,GAiBtB,IAhBKA,EAAKtC,GACTsB,EAAKgB,EACLA,EAAK,IAELhB,EAAKtB,EACLsC,GAAMtC,GAGP+B,EAAKlB,EAAQyB,EAAGX,EAAG,CAAC,EACpBK,EAAKf,EAAQqB,EAAGV,EAAG,CAAC,EAGpBxB,EAAMuB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBlB,EAAMmB,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EAGjBS,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IACtB/B,EAAM8B,CAAG,EAAIjC,EAAKE,EAAM8B,CAAG,CAAE,EAC7BA,GAAM5B,EACN6B,GAAMxB,EAEPuB,GAAM3B,EACN4B,GAAMvB,CACP,CACAsB,GAAM1B,EACN2B,GAAMtB,CACP,CACAqB,GAAMzB,EACN0B,GAAMrB,CACP,CACAoB,GAAMxB,EACNyB,GAAMpB,CACP,CAMN,CAKAnB,GAAO,QAAUG,KCpQjB,IAAAgD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EA0BJ,IArBAA,EAAIxD,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7C2B,EAAKyB,EAAE,GACPlB,EAAKkB,EAAE,GACPjB,EAAKiB,EAAE,GAGPlD,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCoC,EAAKrC,EAAE,OACPsC,EAAKrC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAM6B,EAAG,CAAC,EACVvB,EAAMwB,EAAG,CAAC,EAGJgB,EAAKxB,EAAG,CAAC,EAAGwB,EAAK,GAUtB,IATKA,EAAKjD,GACT+B,EAAKkB,EACLA,EAAK,IAELlB,EAAK/B,EACLiD,GAAMjD,GAEPmB,EAAMe,EAAOe,EAAGjB,EAAG,CAAC,EACpBR,EAAMW,EAAOc,EAAGhB,EAAG,CAAC,EACde,EAAKvB,EAAG,CAAC,EAAGuB,EAAK,GAYtB,IAXKA,EAAKhD,GACT8B,EAAKkB,EACLA,EAAK,IAELlB,EAAK9B,EACLgD,GAAMhD,GAEPQ,EAAMwB,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBlB,EAAMmB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBf,EAAMC,EAAQ6B,EAAGhB,EAAG,CAAC,EACrBT,EAAMC,EAAQwB,EAAGf,EAAG,CAAC,EACfc,EAAKtB,EAAG,CAAC,EAAGsB,EAAK,GAYtB,IAXKA,EAAK/C,GACT6B,EAAKkB,EACLA,EAAK,IAELlB,EAAK7B,EACL+C,GAAM/C,GAEPO,EAAMyB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBnB,EAAMoB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBhB,EAAMC,EAAQ6B,EAAGf,EAAG,CAAC,EACrBV,EAAMC,EAAQwB,EAAGd,EAAG,CAAC,EACfa,GAAKrB,EAAG,CAAC,EAAGqB,GAAK,GAYtB,IAXKA,GAAK9C,GACT4B,EAAKkB,GACLA,GAAK,IAELlB,EAAK5B,EACL8C,IAAM9C,GAEPM,EAAM0B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBpB,EAAMqB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBjB,EAAMC,EAAQ6B,GAAGd,EAAG,CAAC,EACrBX,EAAMC,EAAQwB,GAAGb,EAAG,CAAC,EACfY,EAAKpB,EAAG,CAAC,EAAGoB,EAAK,GAYtB,IAXKA,EAAK7C,GACT2B,EAAKkB,EACLA,EAAK,IAELlB,EAAK3B,EACL6C,GAAM7C,GAEPK,EAAM2B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBrB,EAAMsB,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBlB,EAAMC,EAAQ6B,EAAGb,EAAG,CAAC,EACrBZ,EAAMC,EAAQwB,EAAGZ,EAAG,CAAC,EACfW,EAAKnB,EAAG,CAAC,EAAGmB,EAAK,GAiBtB,IAhBKA,EAAK5C,GACT0B,EAAKkB,EACLA,EAAK,IAELlB,EAAK1B,EACL4C,GAAM5C,GAGPoC,EAAKrB,EAAQ6B,EAAGZ,EAAG,CAAC,EACpBK,EAAKjB,EAAQwB,EAAGX,EAAG,CAAC,EAGpB7B,EAAM4B,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBtB,EAAMuB,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EAGjBU,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IACtBpC,EAAMmC,CAAG,EAAItC,EAAKE,EAAMmC,CAAG,CAAE,EAC7BA,GAAMjC,EACNkC,GAAM5B,EAEP2B,GAAMhC,EACNiC,GAAM3B,CACP,CACA0B,GAAM/B,EACNgC,GAAM1B,CACP,CACAyB,GAAM9B,EACN+B,GAAMzB,CACP,CACAwB,GAAM7B,EACN8B,GAAMxB,CACP,CACAuB,GAAM5B,EACN6B,GAAMvB,CACP,CAOP,CAKArB,GAAO,QAAUG,KC5RjB,IAAAuD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GA0BJ,IArBAA,GAAI/D,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7C+B,EAAK4B,GAAE,GACPpB,EAAKoB,GAAE,GACPnB,EAAKmB,GAAE,GAGPzD,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCyC,EAAK1C,EAAE,OACP2C,EAAK1C,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMkC,EAAG,CAAC,EACV3B,EAAM4B,EAAG,CAAC,EAGJkB,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAUtB,IATKA,GAAKxD,GACToC,EAAKoB,GACLA,GAAK,IAELpB,EAAKpC,EACLwD,IAAMxD,GAEPsB,EAAMiB,EAAOiB,GAAGnB,EAAG,CAAC,EACpBT,EAAMY,EAAOgB,GAAGlB,EAAG,CAAC,EACdiB,GAAK1B,EAAG,CAAC,EAAG0B,GAAK,GAYtB,IAXKA,GAAKvD,GACTmC,EAAKoB,GACLA,GAAK,IAELpB,EAAKnC,EACLuD,IAAMvD,GAEPS,EAAM4B,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBrB,EAAMsB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBjB,EAAMC,EAAQiC,GAAGlB,EAAG,CAAC,EACrBV,EAAMC,EAAQ2B,GAAGjB,EAAG,CAAC,EACfgB,GAAKzB,EAAG,CAAC,EAAGyB,GAAK,GAYtB,IAXKA,GAAKtD,GACTkC,EAAKoB,GACLA,GAAK,IAELpB,EAAKlC,EACLsD,IAAMtD,GAEPQ,EAAM6B,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBtB,EAAMuB,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBlB,EAAMC,EAAQiC,GAAGjB,EAAG,CAAC,EACrBX,EAAMC,EAAQ2B,GAAGhB,EAAG,CAAC,EACfe,GAAKxB,EAAG,CAAC,EAAGwB,GAAK,GAYtB,IAXKA,GAAKrD,GACTiC,EAAKoB,GACLA,GAAK,IAELpB,EAAKjC,EACLqD,IAAMrD,GAEPO,EAAM8B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBvB,EAAMwB,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBnB,EAAMC,EAAQiC,GAAGhB,EAAG,CAAC,EACrBZ,EAAMC,EAAQ2B,GAAGf,EAAG,CAAC,EACfc,EAAKvB,EAAG,CAAC,EAAGuB,EAAK,GAYtB,IAXKA,EAAKpD,GACTgC,EAAKoB,EACLA,EAAK,IAELpB,EAAKhC,EACLoD,GAAMpD,GAEPM,EAAM+B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBxB,EAAMyB,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBpB,EAAMC,EAAQiC,EAAGf,EAAG,CAAC,EACrBb,EAAMC,EAAQ2B,EAAGd,EAAG,CAAC,EACfa,GAAKtB,EAAG,CAAC,EAAGsB,GAAK,GAYtB,IAXKA,GAAKnD,GACT+B,EAAKoB,GACLA,GAAK,IAELpB,EAAK/B,EACLmD,IAAMnD,GAEPK,EAAMgC,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBzB,EAAM0B,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBrB,EAAMC,EAAQiC,GAAGd,EAAG,CAAC,EACrBd,EAAMC,EAAQ2B,GAAGb,EAAG,CAAC,EACfY,EAAKrB,EAAG,CAAC,EAAGqB,EAAK,GAiBtB,IAhBKA,EAAKlD,GACT8B,EAAKoB,EACLA,EAAK,IAELpB,EAAK9B,EACLkD,GAAMlD,GAGPyC,EAAKxB,EAAQiC,EAAGb,EAAG,CAAC,EACpBK,EAAKnB,EAAQ2B,EAAGZ,EAAG,CAAC,EAGpBlC,EAAMiC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvB1B,EAAM2B,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EAGjBW,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKb,EAAIa,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IACtBzC,EAAMwC,CAAG,EAAI3C,EAAKE,EAAMwC,CAAG,CAAE,EAC7BA,GAAMtC,EACNuC,GAAMhC,EAEP+B,GAAMrC,EACNsC,GAAM/B,CACP,CACA8B,GAAMpC,EACNqC,GAAM9B,CACP,CACA6B,GAAMnC,EACNoC,GAAM7B,CACP,CACA4B,GAAMlC,EACNmC,GAAM5B,CACP,CACA2B,GAAMjC,EACNkC,GAAM3B,CACP,CACA0B,GAAMhC,EACNiC,GAAM1B,CACP,CAQR,CAKAvB,GAAO,QAAUG,KCpTjB,IAAA8D,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA0BJ,IArBAA,GAAItE,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CmC,EAAK+B,GAAE,GACPtB,EAAKsB,GAAE,GACPrB,EAAKqB,GAAE,GAGPhE,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpC8C,EAAK/C,EAAE,OACPgD,EAAK/C,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMuC,EAAG,CAAC,EACV/B,EAAMgC,EAAG,CAAC,EAGJoB,GAAK9B,EAAG,CAAC,EAAG8B,GAAK,GAUtB,IATKA,GAAK/D,GACTyC,EAAKsB,GACLA,GAAK,IAELtB,EAAKzC,EACL+D,IAAM/D,GAEPyB,EAAMmB,EAAOmB,GAAGrB,EAAG,CAAC,EACpBV,EAAMa,EAAOkB,GAAGpB,EAAG,CAAC,EACdmB,GAAK7B,EAAG,CAAC,EAAG6B,GAAK,GAYtB,IAXKA,GAAK9D,GACTwC,EAAKsB,GACLA,GAAK,IAELtB,EAAKxC,EACL8D,IAAM9D,GAEPU,EAAMgC,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvBxB,EAAMyB,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBnB,EAAMC,EAAQqC,GAAGpB,EAAG,CAAC,EACrBX,EAAMC,EAAQ8B,GAAGnB,EAAG,CAAC,EACfkB,GAAK5B,EAAG,CAAC,EAAG4B,GAAK,GAYtB,IAXKA,GAAK7D,GACTuC,EAAKsB,GACLA,GAAK,IAELtB,EAAKvC,EACL6D,IAAM7D,GAEPS,EAAMiC,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBzB,EAAM0B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBpB,EAAMC,EAAQqC,GAAGnB,EAAG,CAAC,EACrBZ,EAAMC,EAAQ8B,GAAGlB,EAAG,CAAC,EACfiB,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAYtB,IAXKA,GAAK5D,GACTsC,EAAKsB,GACLA,GAAK,IAELtB,EAAKtC,EACL4D,IAAM5D,GAEPQ,EAAMkC,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvB1B,EAAM2B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBrB,EAAMC,EAAQqC,GAAGlB,EAAG,CAAC,EACrBb,EAAMC,EAAQ8B,GAAGjB,EAAG,CAAC,EACfgB,GAAK1B,EAAG,CAAC,EAAG0B,GAAK,GAYtB,IAXKA,GAAK3D,GACTqC,EAAKsB,GACLA,GAAK,IAELtB,EAAKrC,EACL2D,IAAM3D,GAEPO,EAAMmC,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvB3B,EAAM4B,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBtB,EAAMC,EAAQqC,GAAGjB,EAAG,CAAC,EACrBd,EAAMC,EAAQ8B,GAAGhB,EAAG,CAAC,EACfe,GAAKzB,EAAG,CAAC,EAAGyB,GAAK,GAYtB,IAXKA,GAAK1D,GACToC,EAAKsB,GACLA,GAAK,IAELtB,EAAKpC,EACL0D,IAAM1D,GAEPM,EAAMoC,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvB5B,EAAM6B,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBvB,EAAMC,EAAQqC,GAAGhB,EAAG,CAAC,EACrBf,EAAMC,EAAQ8B,GAAGf,EAAG,CAAC,EACfc,GAAKxB,EAAG,CAAC,EAAGwB,GAAK,GAYtB,IAXKA,GAAKzD,GACTmC,EAAKsB,GACLA,GAAK,IAELtB,EAAKnC,EACLyD,IAAMzD,GAEPK,EAAMqC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvB7B,EAAM8B,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvBxB,EAAMC,EAAQqC,GAAGf,EAAG,CAAC,EACrBhB,EAAMC,EAAQ8B,GAAGd,EAAG,CAAC,EACfa,GAAKvB,EAAG,CAAC,EAAGuB,GAAK,GAiBtB,IAhBKA,GAAKxD,GACTkC,EAAKsB,GACLA,GAAK,IAELtB,EAAKlC,EACLwD,IAAMxD,GAGP8C,GAAK3B,EAAQqC,GAAGd,EAAG,CAAC,EACpBK,EAAKrB,EAAQ8B,GAAGb,EAAG,CAAC,EAGpBvC,EAAMsC,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvB9B,EAAM+B,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EAGjBY,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IACtB9C,EAAM6C,CAAG,EAAIhD,EAAKE,EAAM6C,EAAG,CAAE,EAC7BA,IAAM3C,EACN4C,GAAMpC,EAEPmC,IAAM1C,EACN2C,GAAMnC,CACP,CACAkC,IAAMzC,EACN0C,GAAMlC,CACP,CACAiC,IAAMxC,EACNyC,GAAMjC,CACP,CACAgC,IAAMvC,EACNwC,GAAMhC,CACP,CACA+B,IAAMtC,EACNuC,GAAM/B,CACP,CACA8B,IAAMrC,EACNsC,GAAM9B,CACP,CACA6B,IAAMpC,EACNqC,GAAM7B,CACP,CAST,CAKAzB,GAAO,QAAUG,KC5UjB,IAAAqE,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAgBC,EAAGC,EAAGC,EAAM,CACpC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA0BJ,IArBAA,GAAI7E,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7CuC,EAAKkC,GAAE,GACPxB,EAAKwB,GAAE,GACPvB,EAAKuB,GAAE,GAGPvE,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCmD,EAAKpD,EAAE,OACPqD,EAAKpD,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAM4C,EAAG,CAAC,EACVnC,EAAMoC,EAAG,CAAC,EAGJsB,GAAKjC,EAAG,CAAC,EAAGiC,GAAK,GAUtB,IATKA,GAAKtE,GACT8C,GAAKwB,GACLA,GAAK,IAELxB,GAAK9C,EACLsE,IAAMtE,GAEP4B,EAAMqB,EAAOqB,GAAGvB,EAAG,CAAC,EACpBX,EAAMc,EAAOoB,GAAGtB,EAAG,CAAC,EACdqB,GAAKhC,EAAG,CAAC,EAAGgC,GAAK,GAYtB,IAXKA,GAAKrE,GACT6C,EAAKwB,GACLA,GAAK,IAELxB,EAAK7C,EACLqE,IAAMrE,GAEPW,EAAMoC,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvB3B,EAAM4B,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvBrB,EAAMC,EAAQyC,GAAGtB,EAAG,CAAC,EACrBZ,EAAMC,EAAQiC,GAAGrB,EAAG,CAAC,EACfoB,GAAK/B,EAAG,CAAC,EAAG+B,GAAK,GAYtB,IAXKA,GAAKpE,GACT4C,EAAKwB,GACLA,GAAK,IAELxB,EAAK5C,EACLoE,IAAMpE,GAEPU,EAAMqC,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvB5B,EAAM6B,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBtB,EAAMC,EAAQyC,GAAGrB,EAAG,CAAC,EACrBb,EAAMC,EAAQiC,GAAGpB,EAAG,CAAC,EACfmB,GAAK9B,EAAG,CAAC,EAAG8B,GAAK,GAYtB,IAXKA,GAAKnE,GACT2C,EAAKwB,GACLA,GAAK,IAELxB,EAAK3C,EACLmE,IAAMnE,GAEPS,EAAMsC,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvB7B,EAAM8B,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBvB,EAAMC,EAAQyC,GAAGpB,EAAG,CAAC,EACrBd,EAAMC,EAAQiC,GAAGnB,EAAG,CAAC,EACfkB,GAAK7B,EAAG,CAAC,EAAG6B,GAAK,GAYtB,IAXKA,GAAKlE,GACT0C,EAAKwB,GACLA,GAAK,IAELxB,EAAK1C,EACLkE,IAAMlE,GAEPQ,EAAMuC,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvB9B,EAAM+B,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvBxB,EAAMC,EAAQyC,GAAGnB,EAAG,CAAC,EACrBf,EAAMC,EAAQiC,GAAGlB,EAAG,CAAC,EACfiB,GAAK5B,EAAG,CAAC,EAAG4B,GAAK,GAYtB,IAXKA,GAAKjE,GACTyC,EAAKwB,GACLA,GAAK,IAELxB,EAAKzC,EACLiE,IAAMjE,GAEPO,EAAMwC,EAAG,CAAC,EAAMN,EAAGM,EAAG,CAAC,EACvB/B,EAAMgC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBzB,EAAMC,EAAQyC,GAAGlB,EAAG,CAAC,EACrBhB,EAAMC,EAAQiC,GAAGjB,EAAG,CAAC,EACfgB,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAYtB,IAXKA,GAAKhE,GACTwC,EAAKwB,GACLA,GAAK,IAELxB,EAAKxC,EACLgE,IAAMhE,GAEPM,EAAMyC,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBhC,EAAMiC,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvB1B,EAAMC,EAAQyC,GAAGjB,EAAG,CAAC,EACrBjB,EAAMC,EAAQiC,GAAGhB,EAAG,CAAC,EACfe,GAAK1B,EAAG,CAAC,EAAG0B,GAAK,GAYtB,IAXKA,GAAK/D,GACTuC,EAAKwB,GACLA,GAAK,IAELxB,EAAKvC,EACL+D,IAAM/D,GAEPK,EAAM0C,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvBjC,EAAMkC,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EACvB3B,EAAMC,EAAQyC,GAAGhB,EAAG,CAAC,EACrBlB,EAAMC,EAAQiC,GAAGf,EAAG,CAAC,EACfc,GAAKzB,EAAG,CAAC,EAAGyB,GAAK,GAiBtB,IAhBKA,GAAK9D,GACTsC,EAAKwB,GACLA,GAAK,IAELxB,EAAKtC,EACL8D,IAAM9D,GAGPmD,GAAK9B,EAAQyC,GAAGf,EAAG,CAAC,EACpBK,EAAKvB,EAAQiC,GAAGd,EAAG,CAAC,EAGpB5C,EAAM2C,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EACvBlC,EAAMmC,EAAG,CAAC,EAAMV,EAAGU,EAAG,CAAC,EAGjBa,GAAK,EAAGA,GAAKf,GAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKf,EAAIe,KACtBnD,EAAMkD,CAAG,EAAIrD,EAAKE,EAAMkD,EAAG,CAAE,EAC7BA,IAAMhD,EACNiD,GAAMxC,EAEPuC,IAAM/C,EACNgD,GAAMvC,CACP,CACAsC,IAAM9C,EACN+C,GAAMtC,CACP,CACAqC,IAAM7C,EACN8C,GAAMrC,CACP,CACAoC,IAAM5C,EACN6C,GAAMpC,CACP,CACAmC,IAAM3C,EACN4C,GAAMnC,CACP,CACAkC,IAAM1C,EACN2C,GAAMlC,CACP,CACAiC,IAAMzC,EACN0C,GAAMjC,CACP,CACAgC,IAAMxC,EACNyC,GAAMhC,CACP,CAUV,CAKA3B,GAAO,QAAUG,KCpWjB,IAAA4E,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAwBA,IAAIC,GAAY,QAAS,mDAAoD,EACzEC,GAAY,QAAS,8CAA+C,EAuExE,SAASC,GAAiBC,EAAGC,EAAGC,EAAM,CACrC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GA0BJ,IArBAA,GAAIpF,GAAWG,EAAE,MAAOA,EAAE,QAASC,EAAE,OAAQ,EAC7C2C,EAAKqC,GAAE,GACP1B,EAAK0B,GAAE,GACPzB,GAAKyB,GAAE,GAGP9E,EAAQL,GAAWE,EAAE,MAAOC,EAAE,KAAM,EAGpCwD,GAAKzD,EAAE,OACP0D,GAAKzD,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMiD,EAAG,CAAC,EACVvC,EAAMwC,GAAG,CAAC,EAGJwB,GAAKpC,EAAG,CAAC,EAAGoC,GAAK,GAUtB,IATKA,GAAK7E,GACTmD,GAAK0B,GACLA,GAAK,IAEL1B,GAAKnD,EACL6E,IAAM7E,GAEP+B,EAAMuB,GAAOuB,GAAGzB,EAAG,CAAC,EACpBZ,EAAMe,GAAOsB,GAAGxB,GAAG,CAAC,EACduB,GAAKnC,EAAG,CAAC,EAAGmC,GAAK,GAYtB,IAXKA,GAAK5E,GACTkD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKlD,EACL4E,IAAM5E,GAEPY,EAAMwC,EAAG,CAAC,EAAMF,EAAGE,EAAG,CAAC,EACvB9B,EAAM+B,GAAG,CAAC,EAAMH,EAAGG,GAAG,CAAC,EACvBvB,EAAMC,EAAQ6C,GAAGxB,EAAG,CAAC,EACrBb,EAAMC,EAAQoC,GAAGvB,GAAG,CAAC,EACfsB,GAAKlC,EAAG,CAAC,EAAGkC,GAAK,GAYtB,IAXKA,GAAK3E,GACTiD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKjD,EACL2E,IAAM3E,GAEPW,EAAMyC,EAAG,CAAC,EAAMH,EAAGG,EAAG,CAAC,EACvB/B,EAAMgC,GAAG,CAAC,EAAMJ,EAAGI,GAAG,CAAC,EACvBxB,EAAMC,EAAQ6C,GAAGvB,EAAG,CAAC,EACrBd,EAAMC,EAAQoC,GAAGtB,GAAG,CAAC,EACfqB,GAAKjC,EAAG,CAAC,EAAGiC,GAAK,GAYtB,IAXKA,GAAK1E,GACTgD,EAAK0B,GACLA,GAAK,IAEL1B,EAAKhD,EACL0E,IAAM1E,GAEPU,EAAM0C,EAAG,CAAC,EAAMJ,EAAGI,EAAG,CAAC,EACvBhC,EAAMiC,GAAG,CAAC,EAAML,EAAGK,GAAG,CAAC,EACvBzB,EAAMC,EAAQ6C,GAAGtB,EAAG,CAAC,EACrBf,EAAMC,EAAQoC,GAAGrB,GAAG,CAAC,EACfoB,GAAKhC,EAAG,CAAC,EAAGgC,GAAK,GAYtB,IAXKA,GAAKzE,GACT+C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK/C,EACLyE,IAAMzE,GAEPS,EAAM2C,EAAG,CAAC,EAAML,EAAGK,EAAG,CAAC,EACvBjC,EAAMkC,GAAG,CAAC,EAAMN,EAAGM,GAAG,CAAC,EACvB1B,EAAMC,EAAQ6C,GAAGrB,EAAG,CAAC,EACrBhB,EAAMC,EAAQoC,GAAGpB,GAAG,CAAC,EACfmB,GAAK/B,EAAG,CAAC,EAAG+B,GAAK,GAYtB,IAXKA,GAAKxE,GACT8C,GAAK0B,GACLA,GAAK,IAEL1B,GAAK9C,EACLwE,IAAMxE,GAEPQ,EAAM4C,EAAG,CAAC,EAAMN,GAAGM,EAAG,CAAC,EACvBlC,EAAMmC,GAAG,CAAC,EAAMP,GAAGO,GAAG,CAAC,EACvB3B,EAAMC,EAAQ6C,GAAGpB,EAAG,CAAC,EACrBjB,EAAMC,EAAQoC,GAAGnB,GAAG,CAAC,EACfkB,GAAK9B,EAAG,CAAC,EAAG8B,GAAK,GAYtB,IAXKA,GAAKvE,GACT6C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK7C,EACLuE,IAAMvE,GAEPO,EAAM6C,EAAG,CAAC,EAAMP,EAAGO,EAAG,CAAC,EACvBnC,EAAMoC,GAAG,CAAC,EAAMR,EAAGQ,GAAG,CAAC,EACvB5B,EAAMC,EAAQ6C,GAAGnB,EAAG,CAAC,EACrBlB,EAAMC,EAAQoC,GAAGlB,GAAG,CAAC,EACfiB,GAAK7B,EAAG,CAAC,EAAG6B,GAAK,GAYtB,IAXKA,GAAKtE,GACT4C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK5C,EACLsE,IAAMtE,GAEPM,EAAM8C,EAAG,CAAC,EAAMR,EAAGQ,EAAG,CAAC,EACvBpC,EAAMqC,GAAG,CAAC,EAAMT,EAAGS,GAAG,CAAC,EACvB7B,EAAMC,EAAQ6C,GAAGlB,EAAG,CAAC,EACrBnB,EAAMC,EAAQoC,GAAGjB,GAAG,CAAC,EACfgB,GAAK5B,EAAG,CAAC,EAAG4B,GAAK,GAYtB,IAXKA,GAAKrE,GACT2C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK3C,EACLqE,IAAMrE,GAEPK,EAAM+C,EAAG,CAAC,EAAMT,EAAGS,EAAG,CAAC,EACvBrC,EAAMsC,GAAG,CAAC,EAAMV,EAAGU,GAAG,CAAC,EACvB9B,EAAMC,EAAQ6C,GAAGjB,EAAG,CAAC,EACrBpB,EAAMC,EAAQoC,GAAGhB,GAAG,CAAC,EACfe,GAAK3B,EAAG,CAAC,EAAG2B,GAAK,GAiBtB,IAhBKA,GAAKpE,GACT0C,EAAK0B,GACLA,GAAK,IAEL1B,EAAK1C,EACLoE,IAAMpE,GAGPwD,GAAKjC,EAAQ6C,GAAGhB,EAAG,CAAC,EACpBK,GAAKzB,EAAQoC,GAAGf,GAAG,CAAC,EAGpBjD,EAAMgD,EAAG,CAAC,EAAMV,EAAGU,EAAG,CAAC,EACvBtC,EAAMuC,GAAG,CAAC,EAAMX,EAAGW,GAAG,CAAC,EAGjBc,GAAK,EAAGA,GAAKhB,GAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,GAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKhB,EAAIgB,KACtBxD,EAAMuD,EAAG,EAAI1D,EAAKE,EAAMuD,EAAG,CAAE,EAC7BA,IAAMrD,EACNsD,IAAM5C,EAEP2C,IAAMpD,EACNqD,IAAM3C,CACP,CACA0C,IAAMnD,EACNoD,IAAM1C,CACP,CACAyC,IAAMlD,EACNmD,IAAMzC,CACP,CACAwC,IAAMjD,EACNkD,IAAMxC,CACP,CACAuC,IAAMhD,EACNiD,IAAMvC,CACP,CACAsC,IAAM/C,EACNgD,IAAMtC,CACP,CACAqC,IAAM9C,EACN+C,IAAMrC,CACP,CACAoC,IAAM7C,EACN8C,IAAMpC,CACP,CACAmC,IAAM5C,EACN6C,IAAMnC,CACP,CAWX,CAKA7B,GAAO,QAAUG,KC5XjB,IAAAmF,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA8GA,SAASC,GAASC,EAAGC,EAAGC,EAAM,CAC7BD,EAAE,UAAW,CAAE,EAAGA,EAAE,KAAMA,EAAE,OAAQC,EAAKF,EAAE,UAAW,CAAE,EAAGA,EAAE,KAAMA,EAAE,MAAO,CAAE,CAAE,CACjF,CAKAF,GAAO,QAAUC,KCrHjB,IAAAI,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA8GA,SAASC,GAASC,EAAGC,EAAGC,EAAM,CAC7B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAsBJ,IAjBAH,EAAKT,EAAE,MAAO,CAAE,EAChBO,EAAMP,EAAE,QAAS,CAAE,EACnBQ,EAAMP,EAAE,QAAS,CAAE,EAGnBS,EAAKV,EAAE,OACPW,EAAKV,EAAE,OAGPE,EAAOH,EAAE,KACTI,EAAOH,EAAE,KAGTI,EAAML,EAAE,UAAW,CAAE,EACrBM,EAAML,EAAE,UAAW,CAAE,EAGfW,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAKF,EAAMO,EAAIT,EAAKG,EAAKF,EAAMO,CAAG,CAAE,CAAE,EACtCA,GAAMH,EACNI,GAAMH,CAER,CAKAV,GAAO,QAAUC,KCxJjB,IAAAc,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA+GA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAsCJ,IAjCAR,EAAKZ,EAAE,MACPe,EAAKf,EAAE,QACPgB,EAAKf,EAAE,QACFC,GAEJW,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXJ,EAAMO,EAAI,CAAE,EACZN,EAAMM,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBL,EAAMM,EAAI,CAAE,EACZL,EAAMK,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBH,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXJ,EAAMO,EAAI,CAAE,EACZN,EAAMM,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBL,EAAMM,EAAI,CAAE,EACZL,EAAMK,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKjB,EAAE,OACPkB,EAAKjB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGfmB,EAAK,EAAGA,EAAKN,EAAIM,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKN,EAAIM,IACtBZ,EAAKF,EAAMa,EAAIf,EAAKG,EAAKF,EAAMa,CAAG,CAAE,CAAE,EACtCA,GAAMT,EACNU,GAAMR,EAEPO,GAAMR,EACNS,GAAMP,CACP,CACD,CAKAb,GAAO,QAAUC,KCpLjB,IAAAsB,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA+GA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA4CJ,IAvCAV,EAAKd,EAAE,MACPkB,EAAKlB,EAAE,QACPmB,EAAKlB,EAAE,QACFC,GAEJa,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXN,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBP,EAAMQ,EAAI,CAAE,EACZP,EAAMO,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBN,EAAMM,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBJ,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXN,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBP,EAAMQ,EAAI,CAAE,EACZP,EAAMO,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBN,EAAMM,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKpB,EAAE,OACPqB,EAAKpB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGfuB,EAAK,EAAGA,EAAKP,EAAIO,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKP,EAAIO,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKP,EAAIO,IACtBf,EAAKF,EAAMgB,EAAIlB,EAAKG,EAAKF,EAAMgB,CAAG,CAAE,CAAE,EACtCA,GAAMZ,EACNa,GAAMV,EAEPS,GAAMX,EACNY,GAAMT,CACP,CACAQ,GAAMV,EACNW,GAAMR,CACP,CACD,CAKAf,GAAO,QAAUC,KClMjB,IAAA0B,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA+GA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAkDJ,IA7CAZ,EAAKhB,EAAE,MACPqB,EAAKrB,EAAE,QACPsB,EAAKrB,EAAE,QACFC,GAEJe,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXR,EAAMa,EAAI,CAAE,EACZZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBT,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBP,EAAMO,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBL,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXR,EAAMa,EAAI,CAAE,EACZZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBT,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBP,EAAMO,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKvB,EAAE,OACPwB,EAAKvB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGf2B,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IACtBlB,EAAKF,EAAMmB,EAAIrB,EAAKG,EAAKF,EAAMmB,CAAG,CAAE,CAAE,EACtCA,GAAMf,EACNgB,GAAMZ,EAEPW,GAAMd,EACNe,GAAMX,CACP,CACAU,GAAMb,EACNc,GAAMV,CACP,CACAS,GAAMZ,EACNa,GAAMT,CACP,CACD,CAKAjB,GAAO,QAAUC,KChNjB,IAAA8B,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA+GA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAwDJ,IAnDAd,EAAKlB,EAAE,MACPwB,EAAKxB,EAAE,QACPyB,EAAKxB,EAAE,QACFC,GAEJiB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXV,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBX,EAAMY,EAAI,CAAE,EACZX,EAAMW,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBN,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXV,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBX,EAAMY,EAAI,CAAE,EACZX,EAAMW,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAK1B,EAAE,OACP2B,EAAK1B,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGf+B,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IACtBrB,EAAKF,EAAMsB,EAAIxB,EAAKG,EAAKF,EAAMsB,CAAG,CAAE,CAAE,EACtCA,GAAMlB,EACNmB,GAAMd,EAEPa,GAAMjB,EACNkB,GAAMb,CACP,CACAY,GAAMhB,EACNiB,GAAMZ,CACP,CACAW,GAAMf,EACNgB,GAAMX,CACP,CACAU,GAAMd,EACNe,GAAMV,CACP,CACD,CAKAnB,GAAO,QAAUC,KC9NjB,IAAAkC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAiHA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA8DJ,IAzDAhB,EAAKpB,EAAE,MACP2B,EAAK3B,EAAE,QACP4B,EAAK3B,EAAE,QACFC,GAEJmB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXZ,EAAMmB,EAAI,CAAE,EACZlB,EAAMkB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBb,EAAMc,EAAI,CAAE,EACZb,EAAMa,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBP,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXZ,EAAMmB,EAAI,CAAE,EACZlB,EAAMkB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBb,EAAMc,EAAI,CAAE,EACZb,EAAMa,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAK7B,EAAE,OACP8B,EAAK7B,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGfmC,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IACtBxB,EAAKF,EAAMyB,EAAI3B,EAAKG,EAAKF,EAAMyB,CAAG,CAAE,CAAE,EACtCA,GAAMrB,EACNsB,GAAMhB,EAEPe,GAAMpB,EACNqB,GAAMf,CACP,CACAc,GAAMnB,EACNoB,GAAMd,CACP,CACAa,GAAMlB,EACNmB,GAAMb,CACP,CACAY,GAAMjB,EACNkB,GAAMZ,CACP,CACAW,GAAMhB,EACNiB,GAAMX,CACP,CACD,CAKArB,GAAO,QAAUC,KC9OjB,IAAAsC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAiHA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAoEJ,IA/DAlB,EAAKtB,EAAE,MACP8B,EAAK9B,EAAE,QACP+B,EAAK9B,EAAE,QACFC,GAEJqB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXd,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBf,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBR,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXd,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBf,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKhC,EAAE,OACPiC,EAAKhC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGfuC,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IACtB3B,EAAKF,EAAM4B,EAAI9B,EAAKG,EAAKF,EAAM4B,CAAG,CAAE,CAAE,EACtCA,GAAMxB,EACNyB,GAAMlB,EAEPiB,GAAMvB,EACNwB,GAAMjB,CACP,CACAgB,GAAMtB,EACNuB,GAAMhB,CACP,CACAe,GAAMrB,EACNsB,GAAMf,CACP,CACAc,GAAMpB,EACNqB,GAAMd,CACP,CACAa,GAAMnB,EACNoB,GAAMb,CACP,CACAY,GAAMlB,EACNmB,GAAMZ,CACP,CACD,CAKAvB,GAAO,QAAUC,KC5PjB,IAAA0C,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAiHA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA0EJ,IArEApB,EAAKxB,EAAE,MACPiC,EAAKjC,EAAE,QACPkC,EAAKjC,EAAE,QACFC,GAEJuB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXhB,EAAMyB,EAAI,CAAE,EACZxB,EAAMwB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBjB,EAAMkB,EAAI,CAAE,EACZjB,EAAMiB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBT,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXhB,EAAMyB,EAAI,CAAE,EACZxB,EAAMwB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBjB,EAAMkB,EAAI,CAAE,EACZjB,EAAMiB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKnC,EAAE,OACPoC,EAAKnC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGf2C,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IACtB9B,EAAKF,EAAM+B,EAAIjC,EAAKG,EAAKF,EAAM+B,CAAG,CAAE,CAAE,EACtCA,GAAM3B,EACN4B,GAAMpB,EAEPmB,GAAM1B,EACN2B,GAAMnB,CACP,CACAkB,GAAMzB,EACN0B,GAAMlB,CACP,CACAiB,GAAMxB,EACNyB,GAAMjB,CACP,CACAgB,GAAMvB,EACNwB,GAAMhB,CACP,CACAe,GAAMtB,EACNuB,GAAMf,CACP,CACAc,GAAMrB,EACNsB,GAAMd,CACP,CACAa,GAAMpB,EACNqB,GAAMb,CACP,CACD,CAKAzB,GAAO,QAAUC,KC1QjB,IAAA8C,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAiHA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAgFJ,IA3EAtB,EAAK1B,EAAE,MACPoC,EAAKpC,EAAE,QACPqC,EAAKpC,EAAE,QACFC,GAEJyB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXlB,EAAM4B,EAAI,CAAE,EACZ3B,EAAM2B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBnB,EAAMoB,EAAI,CAAE,EACZnB,EAAMmB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBV,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXlB,EAAM4B,EAAI,CAAE,EACZ3B,EAAM2B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBnB,EAAMoB,EAAI,CAAE,EACZnB,EAAMmB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKtC,EAAE,OACPuC,EAAKtC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGf+C,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IACtBjC,EAAKF,EAAMkC,EAAIpC,EAAKG,EAAKF,EAAMkC,CAAG,CAAE,CAAE,EACtCA,GAAM9B,EACN+B,GAAMtB,EAEPqB,GAAM7B,EACN8B,GAAMrB,CACP,CACAoB,GAAM5B,EACN6B,GAAMpB,CACP,CACAmB,GAAM3B,EACN4B,GAAMnB,CACP,CACAkB,GAAM1B,EACN2B,GAAMlB,CACP,CACAiB,GAAMzB,EACN0B,GAAMjB,CACP,CACAgB,GAAMxB,EACNyB,GAAMhB,CACP,CACAe,GAAMvB,EACNwB,GAAMf,CACP,CACAc,GAAMtB,EACNuB,GAAMd,CACP,CACD,CAKA3B,GAAO,QAAUC,KCxRjB,IAAAkD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAiHA,SAASC,GAAUC,EAAGC,EAAGC,EAAYC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EACAC,EACAC,EAsFJ,IAjFAxB,EAAK5B,EAAE,MACPuC,EAAKvC,EAAE,QACPwC,EAAKvC,EAAE,QACFC,GAEJ2B,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXU,EAAKV,EAAI,CAAE,EACXpB,EAAM+B,EAAI,CAAE,EACZ9B,EAAM8B,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzB7B,EAAM6B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB5B,EAAM4B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzB3B,EAAM2B,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBrB,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMX,EAAGW,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBX,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXU,EAAKV,EAAI,CAAE,EACXpB,EAAM+B,EAAI,CAAE,EACZ9B,EAAM8B,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzB7B,EAAM6B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB5B,EAAM4B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzB3B,EAAM2B,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBrB,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMX,EAAGW,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKzC,EAAE,OACP0C,EAAKzC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGTK,EAAMN,EAAE,UAAW,CAAE,EACrBO,EAAMN,EAAE,UAAW,CAAE,EAGfmD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IACtBpC,EAAKF,EAAMqC,EAAIvC,EAAKG,EAAKF,EAAMqC,CAAG,CAAE,CAAE,EACtCA,GAAMjC,EACNkC,GAAMxB,EAEPuB,GAAMhC,EACNiC,GAAMvB,CACP,CACAsB,GAAM/B,EACNgC,GAAMtB,CACP,CACAqB,GAAM9B,EACN+B,GAAMrB,CACP,CACAoB,GAAM7B,EACN8B,GAAMpB,CACP,CACAmB,GAAM5B,EACN6B,GAAMnB,CACP,CACAkB,GAAM3B,EACN4B,GAAMlB,CACP,CACAiB,GAAM1B,EACN2B,GAAMjB,CACP,CACAgB,GAAMzB,EACN0B,GAAMhB,CACP,CACAe,GAAMxB,EACNyB,GAAMf,CACP,CACD,CAKA7B,GAAO,QAAUC,KCtSjB,IAAAsD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAQ,QAAS,4BAA6B,EAC9CC,GAAY,QAAS,gCAAiC,EAKtDC,GAAO,QA6FX,SAASC,GAASC,EAAGC,EAAGC,EAAM,CAC7B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA4BJ,IA1BAP,EAAKV,EAAE,MAGPO,EAAMX,GAAOc,CAAG,EAGhBP,EAAOH,EAAE,KACTI,EAAOH,EAAE,KAGTU,EAAKX,EAAE,QACPY,EAAKX,EAAE,QAGPY,EAAKb,EAAE,OACPc,EAAKb,EAAE,OAGPI,EAAOL,EAAE,MACTM,EAAOL,EAAE,MAGTO,EAAMR,EAAE,UAAW,CAAE,EACrBS,EAAMR,EAAE,UAAW,CAAE,EAGfgB,EAAI,EAAGA,EAAIV,EAAKU,IACrBF,EAAKlB,GAAWa,EAAIC,EAAIE,EAAIR,EAAMY,EAAGnB,EAAK,EAC1CkB,EAAKnB,GAAWa,EAAIE,EAAIE,EAAIR,EAAMW,EAAGnB,EAAK,EAC1CW,EAAKL,EAAMY,EAAId,EAAKM,EAAKL,EAAMY,CAAG,CAAE,CAAE,CAExC,CAKApB,GAAO,QAAUI,KC9KjB,IAAAmB,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAyFA,SAASC,GAASC,EAAGC,EAAGC,EAAM,CAC7BD,EAAE,KAAMA,EAAE,MAAO,EAAIC,EAAKF,EAAE,KAAMA,EAAE,MAAO,CAAE,CAC9C,CAKAF,GAAO,QAAUC,KChGjB,IAAAI,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAyFA,SAASC,GAASC,EAAGC,EAAGC,EAAM,CAC7B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAkBJ,IAbAH,EAAKP,EAAE,MAAO,CAAE,EAChBK,EAAML,EAAE,QAAS,CAAE,EACnBM,EAAML,EAAE,QAAS,CAAE,EAGnBO,EAAKR,EAAE,OACPS,EAAKR,EAAE,OAGPE,EAAOH,EAAE,KACTI,EAAOH,EAAE,KAGHS,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,CAAG,EAAIP,EAAKC,EAAMK,CAAG,CAAE,EAC7BA,GAAMH,EACNI,GAAMH,CAER,CAKAR,GAAO,QAAUC,KC7HjB,IAAAY,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA0FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAkCJ,IA7BAR,EAAKV,EAAE,MACPa,EAAKb,EAAE,QACPc,EAAKb,EAAE,QACFC,GAEJS,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXJ,EAAMO,EAAI,CAAE,EACZN,EAAMM,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBL,EAAMM,EAAI,CAAE,EACZL,EAAMK,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBH,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXJ,EAAMO,EAAI,CAAE,EACZN,EAAMM,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBL,EAAMM,EAAI,CAAE,EACZL,EAAMK,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKf,EAAE,OACPgB,EAAKf,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHiB,EAAK,EAAGA,EAAKN,EAAIM,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKN,EAAIM,IACtBZ,EAAMW,CAAG,EAAIb,EAAKC,EAAMW,CAAG,CAAE,EAC7BA,GAAMT,EACNU,GAAMR,EAEPO,GAAMR,EACNS,GAAMP,CACP,CACD,CAKAX,GAAO,QAAUC,KCzJjB,IAAAoB,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA0FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAwCJ,IAnCAV,EAAKZ,EAAE,MACPgB,EAAKhB,EAAE,QACPiB,EAAKhB,EAAE,QACFC,GAEJW,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXN,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBP,EAAMQ,EAAI,CAAE,EACZP,EAAMO,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBN,EAAMM,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBJ,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXN,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBP,EAAMQ,EAAI,CAAE,EACZP,EAAMO,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBN,EAAMM,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKlB,EAAE,OACPmB,EAAKlB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHqB,EAAK,EAAGA,EAAKP,EAAIO,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKP,EAAIO,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKP,EAAIO,IACtBf,EAAMc,CAAG,EAAIhB,EAAKC,EAAMc,CAAG,CAAE,EAC7BA,GAAMZ,EACNa,GAAMV,EAEPS,GAAMX,EACNY,GAAMT,CACP,CACAQ,GAAMV,EACNW,GAAMR,CACP,CACD,CAKAb,GAAO,QAAUC,KCvKjB,IAAAwB,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA0FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA8CJ,IAzCAZ,EAAKd,EAAE,MACPmB,EAAKnB,EAAE,QACPoB,EAAKnB,EAAE,QACFC,GAEJa,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXR,EAAMa,EAAI,CAAE,EACZZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBT,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBP,EAAMO,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBL,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXR,EAAMa,EAAI,CAAE,EACZZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBT,EAAMU,EAAI,CAAE,EACZT,EAAMS,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBP,EAAMO,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKrB,EAAE,OACPsB,EAAKrB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHyB,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKR,EAAIQ,IACtBlB,EAAMiB,CAAG,EAAInB,EAAKC,EAAMiB,CAAG,CAAE,EAC7BA,GAAMf,EACNgB,GAAMZ,EAEPW,GAAMd,EACNe,GAAMX,CACP,CACAU,GAAMb,EACNc,GAAMV,CACP,CACAS,GAAMZ,EACNa,GAAMT,CACP,CACD,CAKAf,GAAO,QAAUC,KCrLjB,IAAA4B,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA0FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAoDJ,IA/CAd,EAAKhB,EAAE,MACPsB,EAAKtB,EAAE,QACPuB,EAAKtB,EAAE,QACFC,GAEJe,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXV,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBX,EAAMY,EAAI,CAAE,EACZX,EAAMW,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBN,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXV,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBX,EAAMY,EAAI,CAAE,EACZX,EAAMW,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBR,EAAMQ,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKxB,EAAE,OACPyB,EAAKxB,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGH6B,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKT,EAAIS,IACtBrB,EAAMoB,CAAG,EAAItB,EAAKC,EAAMoB,CAAG,CAAE,EAC7BA,GAAMlB,EACNmB,GAAMd,EAEPa,GAAMjB,EACNkB,GAAMb,CACP,CACAY,GAAMhB,EACNiB,GAAMZ,CACP,CACAW,GAAMf,EACNgB,GAAMX,CACP,CACAU,GAAMd,EACNe,GAAMV,CACP,CACD,CAKAjB,GAAO,QAAUC,KCnMjB,IAAAgC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA4FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA0DJ,IArDAhB,EAAKlB,EAAE,MACPyB,EAAKzB,EAAE,QACP0B,EAAKzB,EAAE,QACFC,GAEJiB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXZ,EAAMmB,EAAI,CAAE,EACZlB,EAAMkB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBb,EAAMc,EAAI,CAAE,EACZb,EAAMa,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBP,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXZ,EAAMmB,EAAI,CAAE,EACZlB,EAAMkB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBb,EAAMc,EAAI,CAAE,EACZb,EAAMa,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBT,EAAMS,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAK3B,EAAE,OACP4B,EAAK3B,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHiC,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKV,EAAIU,IACtBxB,EAAMuB,CAAG,EAAIzB,EAAKC,EAAMuB,CAAG,CAAE,EAC7BA,GAAMrB,EACNsB,GAAMhB,EAEPe,GAAMpB,EACNqB,GAAMf,CACP,CACAc,GAAMnB,EACNoB,GAAMd,CACP,CACAa,GAAMlB,EACNmB,GAAMb,CACP,CACAY,GAAMjB,EACNkB,GAAMZ,CACP,CACAW,GAAMhB,EACNiB,GAAMX,CACP,CACD,CAKAnB,GAAO,QAAUC,KCnNjB,IAAAoC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA4FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAgEJ,IA3DAlB,EAAKpB,EAAE,MACP4B,EAAK5B,EAAE,QACP6B,EAAK5B,EAAE,QACFC,GAEJmB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXd,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBf,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBR,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXd,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBf,EAAMgB,EAAI,CAAE,EACZf,EAAMe,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBV,EAAMU,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAK9B,EAAE,OACP+B,EAAK9B,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHqC,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKX,EAAIW,IACtB3B,EAAM0B,CAAG,EAAI5B,EAAKC,EAAM0B,CAAG,CAAE,EAC7BA,GAAMxB,EACNyB,GAAMlB,EAEPiB,GAAMvB,EACNwB,GAAMjB,CACP,CACAgB,GAAMtB,EACNuB,GAAMhB,CACP,CACAe,GAAMrB,EACNsB,GAAMf,CACP,CACAc,GAAMpB,EACNqB,GAAMd,CACP,CACAa,GAAMnB,EACNoB,GAAMb,CACP,CACAY,GAAMlB,EACNmB,GAAMZ,CACP,CACD,CAKArB,GAAO,QAAUC,KCjOjB,IAAAwC,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA4FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAsEJ,IAjEApB,EAAKtB,EAAE,MACP+B,EAAK/B,EAAE,QACPgC,EAAK/B,EAAE,QACFC,GAEJqB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXhB,EAAMyB,EAAI,CAAE,EACZxB,EAAMwB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBjB,EAAMkB,EAAI,CAAE,EACZjB,EAAMiB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBT,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXhB,EAAMyB,EAAI,CAAE,EACZxB,EAAMwB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBjB,EAAMkB,EAAI,CAAE,EACZjB,EAAMiB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBX,EAAMW,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKjC,EAAE,OACPkC,EAAKjC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHyC,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKZ,EAAIY,IACtB9B,EAAM6B,CAAG,EAAI/B,EAAKC,EAAM6B,CAAG,CAAE,EAC7BA,GAAM3B,EACN4B,GAAMpB,EAEPmB,GAAM1B,EACN2B,GAAMnB,CACP,CACAkB,GAAMzB,EACN0B,GAAMlB,CACP,CACAiB,GAAMxB,EACNyB,GAAMjB,CACP,CACAgB,GAAMvB,EACNwB,GAAMhB,CACP,CACAe,GAAMtB,EACNuB,GAAMf,CACP,CACAc,GAAMrB,EACNsB,GAAMd,CACP,CACAa,GAAMpB,EACNqB,GAAMb,CACP,CACD,CAKAvB,GAAO,QAAUC,KC/OjB,IAAA4C,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA4FA,SAASC,GAASC,EAAGC,EAAGC,EAAYC,EAAM,CACzC,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EA4EJ,IAvEAtB,EAAKxB,EAAE,MACPkC,EAAKlC,EAAE,QACPmC,EAAKlC,EAAE,QACFC,GAEJuB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXlB,EAAM4B,EAAI,CAAE,EACZ3B,EAAM2B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBnB,EAAMoB,EAAI,CAAE,EACZnB,EAAMmB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBV,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXlB,EAAM4B,EAAI,CAAE,EACZ3B,EAAM2B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBrB,EAAMqB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBnB,EAAMoB,EAAI,CAAE,EACZnB,EAAMmB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBZ,EAAMY,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKpC,EAAE,OACPqC,EAAKpC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGH6C,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKb,EAAIa,IACtBjC,EAAMgC,CAAG,EAAIlC,EAAKC,EAAMgC,CAAG,CAAE,EAC7BA,GAAM9B,EACN+B,GAAMtB,EAEPqB,GAAM7B,EACN8B,GAAMrB,CACP,CACAoB,GAAM5B,EACN6B,GAAMpB,CACP,CACAmB,GAAM3B,EACN4B,GAAMnB,CACP,CACAkB,GAAM1B,EACN2B,GAAMlB,CACP,CACAiB,GAAMzB,EACN0B,GAAMjB,CACP,CACAgB,GAAMxB,EACNyB,GAAMhB,CACP,CACAe,GAAMvB,EACNwB,GAAMf,CACP,CACAc,GAAMtB,EACNuB,GAAMd,CACP,CACD,CAKAzB,GAAO,QAAUC,KC7PjB,IAAAgD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cA4FA,SAASC,GAAUC,EAAGC,EAAGC,EAAYC,EAAM,CAC1C,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GACAC,EAkFJ,IA7EAxB,EAAK1B,EAAE,MACPqC,EAAKrC,EAAE,QACPsC,EAAKrC,EAAE,QACFC,GAEJyB,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXU,EAAKV,EAAI,CAAE,EACXpB,EAAM+B,EAAI,CAAE,EACZ9B,EAAM8B,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzB7B,EAAM6B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB5B,EAAM4B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzB3B,EAAM2B,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBrB,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMX,EAAGW,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,IAGzBX,EAAKD,EAAI,CAAE,EACXE,EAAKF,EAAI,CAAE,EACXG,EAAKH,EAAI,CAAE,EACXI,EAAKJ,EAAI,CAAE,EACXK,EAAKL,EAAI,CAAE,EACXM,EAAKN,EAAI,CAAE,EACXO,EAAKP,EAAI,CAAE,EACXQ,EAAKR,EAAI,CAAE,EACXS,EAAKT,EAAI,CAAE,EACXU,EAAKV,EAAI,CAAE,EACXpB,EAAM+B,EAAI,CAAE,EACZ9B,EAAM8B,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzB7B,EAAM6B,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzB5B,EAAM4B,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzB3B,EAAM2B,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzB1B,EAAM0B,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBzB,EAAMyB,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBxB,EAAMwB,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBvB,EAAMuB,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,EACzBtB,EAAMsB,EAAI,CAAE,EAAMF,EAAGE,EAAG,CAAC,EACzBrB,EAAMsB,EAAI,CAAE,EACZrB,EAAMqB,EAAI,CAAE,EAAMX,EAAGW,EAAG,CAAC,EACzBpB,EAAMoB,EAAI,CAAE,EAAMV,EAAGU,EAAG,CAAC,EACzBnB,EAAMmB,EAAI,CAAE,EAAMT,EAAGS,EAAG,CAAC,EACzBlB,EAAMkB,EAAI,CAAE,EAAMR,EAAGQ,EAAG,CAAC,EACzBjB,EAAMiB,EAAI,CAAE,EAAMP,EAAGO,EAAG,CAAC,EACzBhB,EAAMgB,EAAI,CAAE,EAAMN,EAAGM,EAAG,CAAC,EACzBf,EAAMe,EAAI,CAAE,EAAML,EAAGK,EAAG,CAAC,EACzBd,EAAMc,EAAI,CAAE,EAAMJ,EAAGI,EAAG,CAAC,EACzBb,EAAMa,EAAI,CAAE,EAAMH,EAAGG,EAAG,CAAC,GAG1BC,EAAKvC,EAAE,OACPwC,EAAKvC,EAAE,OAGPG,EAAOJ,EAAE,KACTK,EAAOJ,EAAE,KAGHiD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,GAAK,EAAGA,GAAKd,EAAIc,KAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IAAO,CAC7B,IAAMD,EAAK,EAAGA,EAAKd,EAAIc,IACtBpC,EAAMmC,CAAG,EAAIrC,EAAKC,EAAMmC,CAAG,CAAE,EAC7BA,GAAMjC,EACNkC,GAAMxB,EAEPuB,GAAMhC,EACNiC,GAAMvB,CACP,CACAsB,GAAM/B,EACNgC,GAAMtB,CACP,CACAqB,GAAM9B,EACN+B,GAAMrB,CACP,CACAoB,GAAM7B,EACN8B,GAAMpB,CACP,CACAmB,GAAM5B,EACN6B,GAAMnB,CACP,CACAkB,GAAM3B,EACN4B,GAAMlB,CACP,CACAiB,GAAM1B,EACN2B,GAAMjB,CACP,CACAgB,GAAMzB,EACN0B,GAAMhB,CACP,CACAe,GAAMxB,EACNyB,GAAMf,CACP,CACD,CAKA3B,GAAO,QAAUC,KC3QjB,IAAAoD,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAQ,QAAS,4BAA6B,EAC9CC,GAAY,QAAS,gCAAiC,EAKtDC,GAAO,QAwEX,SAASC,GAASC,EAAGC,EAAGC,EAAM,CAC7B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAwBJ,IAtBAP,EAAKR,EAAE,MAGPO,EAAMX,GAAOY,CAAG,EAGhBL,EAAOH,EAAE,KACTI,EAAOH,EAAE,KAGTQ,EAAKT,EAAE,QACPU,EAAKT,EAAE,QAGPU,EAAKX,EAAE,OACPY,EAAKX,EAAE,OAGPI,EAAOL,EAAE,MACTM,EAAOL,EAAE,MAGHc,EAAI,EAAGA,EAAIR,EAAKQ,IACrBF,EAAKhB,GAAWW,EAAIC,EAAIE,EAAIN,EAAMU,EAAGjB,EAAK,EAC1CgB,EAAKjB,GAAWW,EAAIE,EAAIE,EAAIN,EAAMS,EAAGjB,EAAK,EAC1CM,EAAMU,CAAG,EAAIZ,EAAKC,EAAMU,CAAG,CAAE,CAE/B,CAKAlB,GAAO,QAAUI,KCnJjB,IAAAiB,GAAAC,GAAA,SAAAC,GAAAC,GAAA,cAsBA,IAAIC,GAAiB,QAAS,sCAAuC,EACjEC,GAAgB,QAAS,oCAAqC,EAC9DC,GAAwB,QAAS,+CAAgD,EACjFC,GAAiB,QAAS,yCAA0C,EACpEC,GAAS,QAAS,uBAAwB,EAC1CC,GAAyB,KACzBC,GAAyB,KACzBC,GAAyB,KACzBC,GAAyB,KACzBC,GAAyB,KACzBC,GAAyB,KACzBC,GAAyB,KACzBC,GAAyB,KACzBC,GAA0B,KAC1BC,GAAiB,KACjBC,GAAiB,KACjBC,GAAiB,KACjBC,GAAiB,KACjBC,GAAiB,KACjBC,GAAiB,KACjBC,GAAiB,KACjBC,GAAiB,KACjBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAkB,KAClBC,GAAmB,KACnBC,GAAkB,KAClBC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAU,KACVC,GAAW,KACXC,GAAU,KAKVC,GAAQ,CACXZ,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,EACD,EACIG,GAAiB,CACpBzB,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,EACD,EACIgB,GAAgB,CACnBnC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,EACD,EACI4B,GAAyB,CAC5B7C,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,EACD,EACIsC,GAAWJ,GAAM,OAAS,EAuE9B,SAASK,GAAOC,EAAQC,EAAM,CAC7B,IAAIC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAUJ,GAPAH,EAAIlE,GAAgBkD,EAAQ,CAAE,CAAE,EAChCiB,EAAInE,GAAgBkD,EAAQ,CAAE,CAAE,EAGhCK,EAAMW,EAAE,MACRV,EAAMW,EAAE,MACRf,EAAQG,EAAI,OACPH,IAAUI,EAAI,OAClB,MAAM,IAAI,MAAOvD,GAAQ,uHAAwHmD,EAAOI,EAAI,MAAO,CAAE,EAGtK,GAAKJ,IAAU,EACd,OAAKc,EAAE,kBAAoBC,EAAE,iBACrBtB,GAAgBO,CAAM,EAAGc,EAAGC,EAAGhB,CAAI,EAEpCP,GAAOQ,CAAM,EAAGc,EAAGC,EAAGhB,CAAI,EAKlC,IAFAQ,EAAM,EACNM,EAAK,EACCI,EAAI,EAAGA,EAAIjB,EAAOiB,IAAM,CAE7B,GADAD,EAAIb,EAAKc,CAAE,EACND,IAAMZ,EAAKa,CAAE,EACjB,MAAM,IAAI,MAAO,qDAAsD,EAGxEV,GAAOS,EAGFA,IAAM,IACVH,GAAM,EAER,CAEA,GAAKN,IAAQ,EAIb,IAAKP,IAAU,EACd,OAAKc,EAAE,kBAAoBC,EAAE,iBACrBtB,GAAgBO,CAAM,EAAGc,EAAGC,EAAGhB,CAAI,EAEpCP,GAAOQ,CAAM,EAAGc,EAAGC,EAAGhB,CAAI,EAMlC,GAJAU,EAAKK,EAAE,QACPJ,EAAKK,EAAE,QAGFF,IAAOb,EAAM,EAAI,CAErB,IAAMiB,EAAI,EAAGA,EAAIjB,GACXG,EAAKc,CAAE,IAAM,EADKA,IACvB,CAQD,OAJAH,EAAE,MAAQ,CAAEX,EAAIc,CAAC,CAAE,EACnBF,EAAE,MAAQD,EAAE,MACZA,EAAE,QAAU,CAAEL,EAAGQ,CAAC,CAAE,EACpBF,EAAE,QAAU,CAAEL,EAAGO,CAAC,CAAE,EACfH,EAAE,kBAAoBC,EAAE,iBACrBtB,GAAgB,CAAE,EAAGqB,EAAGC,EAAGhB,CAAI,EAEhCP,GAAO,CAAE,EAAGsB,EAAGC,EAAGhB,CAAI,CAC9B,CAMA,GALAM,EAAM5D,GAAgBgE,CAAG,EACzBH,EAAM7D,GAAgBiE,CAAG,EAGzBF,EAAM9D,GAAe+D,CAAG,EACnBJ,IAAQ,GAAKC,IAAQ,GAAKE,IAAQ9D,GAAegE,CAAG,EAAI,CAM5D,GAJAT,EAAOtD,GAAuBwD,EAAKM,EAAIK,EAAE,MAAO,EAChDZ,EAAOvD,GAAuByD,EAAKM,EAAIK,EAAE,MAAO,EAG3CR,IAAUN,EAAK,CAAC,EAAEA,EAAK,CAAC,EAAE,GAAOM,IAAUL,EAAK,CAAC,EAAEA,EAAK,CAAC,EAAE,EAkB/D,OAhBKG,IAAQ,EACZM,EAAKV,EAAM,CAAE,EAEbU,EAAKV,EAAM,CAAE,EAETK,IAAQ,EACZM,EAAKV,EAAM,CAAE,EAEbU,EAAKV,EAAM,CAAE,EAEdY,EAAE,MAAQ,CAAEP,CAAI,EAChBQ,EAAE,MAAQD,EAAE,MACZA,EAAE,QAAU,CAAET,CAAI,EAClBU,EAAE,QAAU,CAAET,CAAI,EAClBQ,EAAE,OAASH,EACXI,EAAE,OAASH,EACNE,EAAE,kBAAoBC,EAAE,iBACrBtB,GAAgB,CAAE,EAAGqB,EAAGC,EAAGhB,CAAI,EAEhCP,GAAO,CAAE,EAAGsB,EAAGC,EAAGhB,CAAI,EAK9B,GAAKC,GAASJ,GAEb,OAAKkB,EAAE,kBAAoBC,EAAE,iBACrBtB,GAAgBO,CAAM,EAAGc,EAAGC,EAAGP,EAAKT,CAAI,EAEzCP,GAAOQ,CAAM,EAAGc,EAAGC,EAAGP,EAAKT,CAAI,CAGxC,CAIA,GAAKC,GAASJ,GACb,OAAKkB,EAAE,kBAAoBC,EAAE,iBACrBpB,GAAwBK,EAAM,CAAE,EAAGc,EAAGC,EAAGhB,CAAI,EAE9CL,GAAeM,EAAM,CAAE,EAAGc,EAAGC,EAAGhB,CAAI,EAG5C,GAAKe,EAAE,kBAAoBC,EAAE,iBAC5B,OAAOpC,GAAiBmC,EAAGC,EAAGhB,CAAI,EAEnCR,GAASuB,EAAGC,EAAGhB,CAAI,EACpB,CAKAvD,GAAO,QAAUqD,KC3QjB,IAAIqB,GAAO,KAKX,OAAO,QAAUA", - "names": ["require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary2d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dy0", "dy1", "ox1", "oy1", "sh", "s0", "s1", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "j0", "j1", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary3d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dy0", "dy1", "dy2", "ox1", "ox2", "oy1", "oy2", "sh", "s0", "s1", "s2", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "j0", "j1", "j2", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary4d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dy0", "dy1", "dy2", "dy3", "ox1", "ox2", "ox3", "oy1", "oy2", "oy3", "sh", "s0", "s1", "s2", "s3", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "j0", "j1", "j2", "j3", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary5d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dy0", "dy1", "dy2", "dy3", "dy4", "ox1", "ox2", "ox3", "ox4", "oy1", "oy2", "oy3", "oy4", "sh", "s0", "s1", "s2", "s3", "s4", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "j0", "j1", "j2", "j3", "j4", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary6d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "ox1", "ox2", "ox3", "ox4", "ox5", "oy1", "oy2", "oy3", "oy4", "oy5", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "j0", "j1", "j2", "j3", "j4", "j5", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary7d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary8d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "ox7", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "oy7", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary9d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "ox7", "ox8", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "oy7", "oy8", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "j8", "o", "require_d_blocked_accessors", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary10d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dx9", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "dy9", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "ox7", "ox8", "ox9", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "oy7", "oy8", "oy9", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "i9", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "j8", "j9", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary2d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dy0", "dy1", "ox1", "oy1", "sh", "s0", "s1", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "j0", "j1", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary3d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dy0", "dy1", "dy2", "ox1", "ox2", "oy1", "oy2", "sh", "s0", "s1", "s2", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "j0", "j1", "j2", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary4d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dy0", "dy1", "dy2", "dy3", "ox1", "ox2", "ox3", "oy1", "oy2", "oy3", "sh", "s0", "s1", "s2", "s3", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "j0", "j1", "j2", "j3", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary5d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dy0", "dy1", "dy2", "dy3", "dy4", "ox1", "ox2", "ox3", "ox4", "oy1", "oy2", "oy3", "oy4", "sh", "s0", "s1", "s2", "s3", "s4", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "j0", "j1", "j2", "j3", "j4", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary6d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "ox1", "ox2", "ox3", "ox4", "ox5", "oy1", "oy2", "oy3", "oy4", "oy5", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "j0", "j1", "j2", "j3", "j4", "j5", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary7d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary8d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "ox7", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "oy7", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary9d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "ox7", "ox8", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "oy7", "oy8", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "j8", "o", "require_d_blocked", "__commonJSMin", "exports", "module", "loopOrder", "blockSize", "blockedunary10d", "x", "y", "fcn", "bsize", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dx9", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "dy9", "ox1", "ox2", "ox3", "ox4", "ox5", "ox6", "ox7", "ox8", "ox9", "oy1", "oy2", "oy3", "oy4", "oy5", "oy6", "oy7", "oy8", "oy9", "sh", "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "sx", "sy", "ox", "oy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "i9", "j0", "j1", "j2", "j3", "j4", "j5", "j6", "j7", "j8", "j9", "o", "require_d_accessors", "__commonJSMin", "exports", "module", "unary0d", "x", "y", "fcn", "require_d_accessors", "__commonJSMin", "exports", "module", "unary1d", "x", "y", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dy0", "S0", "ix", "iy", "i0", "require_d_accessors", "__commonJSMin", "exports", "module", "unary2d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dy0", "dy1", "sh", "S0", "S1", "sx", "sy", "ix", "iy", "i0", "i1", "require_d_accessors", "__commonJSMin", "exports", "module", "unary3d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dy0", "dy1", "dy2", "sh", "S0", "S1", "S2", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "require_d_accessors", "__commonJSMin", "exports", "module", "unary4d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dy0", "dy1", "dy2", "dy3", "sh", "S0", "S1", "S2", "S3", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "require_d_accessors", "__commonJSMin", "exports", "module", "unary5d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dy0", "dy1", "dy2", "dy3", "dy4", "sh", "S0", "S1", "S2", "S3", "S4", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "require_d_accessors", "__commonJSMin", "exports", "module", "unary6d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "require_d_accessors", "__commonJSMin", "exports", "module", "unary7d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "require_d_accessors", "__commonJSMin", "exports", "module", "unary8d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "require_d_accessors", "__commonJSMin", "exports", "module", "unary9d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "require_d_accessors", "__commonJSMin", "exports", "module", "unary10d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "get", "set", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dx9", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "dy9", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "i9", "require_nd_accessors", "__commonJSMin", "exports", "module", "numel", "vind2bind", "MODE", "unarynd", "x", "y", "fcn", "xbuf", "ybuf", "ordx", "ordy", "len", "get", "set", "sh", "sx", "sy", "ox", "oy", "ix", "iy", "i", "require_d", "__commonJSMin", "exports", "module", "unary0d", "x", "y", "fcn", "require_d", "__commonJSMin", "exports", "module", "unary1d", "x", "y", "fcn", "xbuf", "ybuf", "dx0", "dy0", "S0", "ix", "iy", "i0", "require_d", "__commonJSMin", "exports", "module", "unary2d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dy0", "dy1", "sh", "S0", "S1", "sx", "sy", "ix", "iy", "i0", "i1", "require_d", "__commonJSMin", "exports", "module", "unary3d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dy0", "dy1", "dy2", "sh", "S0", "S1", "S2", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "require_d", "__commonJSMin", "exports", "module", "unary4d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dy0", "dy1", "dy2", "dy3", "sh", "S0", "S1", "S2", "S3", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "require_d", "__commonJSMin", "exports", "module", "unary5d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dy0", "dy1", "dy2", "dy3", "dy4", "sh", "S0", "S1", "S2", "S3", "S4", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "require_d", "__commonJSMin", "exports", "module", "unary6d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "require_d", "__commonJSMin", "exports", "module", "unary7d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "require_d", "__commonJSMin", "exports", "module", "unary8d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "require_d", "__commonJSMin", "exports", "module", "unary9d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "require_d", "__commonJSMin", "exports", "module", "unary10d", "x", "y", "isRowMajor", "fcn", "xbuf", "ybuf", "dx0", "dx1", "dx2", "dx3", "dx4", "dx5", "dx6", "dx7", "dx8", "dx9", "dy0", "dy1", "dy2", "dy3", "dy4", "dy5", "dy6", "dy7", "dy8", "dy9", "sh", "S0", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9", "sx", "sy", "ix", "iy", "i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8", "i9", "require_nd", "__commonJSMin", "exports", "module", "numel", "vind2bind", "MODE", "unarynd", "x", "y", "fcn", "xbuf", "ybuf", "ordx", "ordy", "len", "sh", "sx", "sy", "ox", "oy", "ix", "iy", "i", "require_main", "__commonJSMin", "exports", "module", "iterationOrder", "strides2order", "minmaxViewBufferIndex", "ndarray2object", "format", "blockedaccessorunary2d", "blockedaccessorunary3d", "blockedaccessorunary4d", "blockedaccessorunary5d", "blockedaccessorunary6d", "blockedaccessorunary7d", "blockedaccessorunary8d", "blockedaccessorunary9d", "blockedaccessorunary10d", "blockedunary2d", "blockedunary3d", "blockedunary4d", "blockedunary5d", "blockedunary6d", "blockedunary7d", "blockedunary8d", "blockedunary9d", "blockedunary10d", "accessorunary0d", "accessorunary1d", "accessorunary2d", "accessorunary3d", "accessorunary4d", "accessorunary5d", "accessorunary6d", "accessorunary7d", "accessorunary8d", "accessorunary9d", "accessorunary10d", "accessorunarynd", "unary0d", "unary1d", "unary2d", "unary3d", "unary4d", "unary5d", "unary6d", "unary7d", "unary8d", "unary9d", "unary10d", "unarynd", "UNARY", "ACCESSOR_UNARY", "BLOCKED_UNARY", "BLOCKED_ACCESSOR_UNARY", "MAX_DIMS", "unary", "arrays", "fcn", "ndims", "xmmv", "ymmv", "shx", "shy", "iox", "ioy", "len", "ord", "sx", "sy", "ox", "oy", "ns", "x", "y", "d", "i", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index abda8b1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,67 +0,0 @@ - -{{alias}}( arrays, fcn ) - Applies a unary callback to elements in an input ndarray and assigns results - to elements in an output ndarray. - - Each provided "ndarray" should be an object with the following properties: - - - dtype: data type. - - data: data buffer. - - shape: dimensions. - - strides: stride lengths. - - offset: index offset. - - order: specifies whether an ndarray is row-major (C-style) or column-major - (Fortran-style). - - Parameters - ---------- - arrays: ArrayLikeObject - Array-like object containing one input ndarray and one output ndarray. - - fcn: Function - Unary callback. - - Examples - -------- - // Define ndarray data and meta data... - > var xbuf = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] ); - > var ybuf = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); - > var dtype = 'float64'; - > var shape = [ 2, 2 ]; - > var sx = [ 2, 1 ]; - > var sy = [ 2, 1 ]; - > var ox = 0; - > var oy = 0; - > var order = 'row-major'; - - // Using ndarrays... - > var x = {{alias:@stdlib/ndarray/ctor}}( dtype, xbuf, shape, sx, ox, order ); - > var y = {{alias:@stdlib/ndarray/ctor}}( dtype, ybuf, shape, sy, oy, order ); - > {{alias}}( [ x, y ], {{alias:@stdlib/math/base/special/abs}} ); - > y.data - [ 1.0, 2.0, 3.0, 4.0 ] - - // Using minimal ndarray-like objects... - > x = { - ... 'dtype': dtype, - ... 'data': xbuf, - ... 'shape': shape, - ... 'strides': sx, - ... 'offset': ox, - ... 'order': order - ... }; - > y = { - ... 'dtype': dtype, - ... 'data': ybuf, - ... 'shape': shape, - ... 'strides': sy, - ... 'offset': oy, - ... 'order': order - ... }; - > {{alias}}( [ x, y ], {{alias:@stdlib/math/base/special/abs}} ); - > y.data - [ 1.0, 2.0, 3.0, 4.0 ] - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 626f5f2..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 } from '@stdlib/types/ndarray'; -import unary = require( './index' ); - -/** -* Mock function to create an ndarray-like object. -* -* @returns ndarray-like object -*/ -function array(): ndarray { - const obj: ndarray = { - 'byteLength': 80, - 'BYTES_PER_ELEMENT': 8, - 'data': new Float64Array( 10 ), - 'dtype': 'float64', - 'flags': { - 'ROW_MAJOR_CONTIGUOUS': true, - 'COLUMN_MAJOR_CONTIGUOUS': false - }, - 'length': 10, - 'ndims': 1, - 'offset': 0, - 'order': 'row-major', - 'shape': [ 10 ], - 'strides': [ 1 ], - 'get': (): number => 0, - 'set': (): ndarray => obj - }; - return obj; -} - -/** -* Evaluates the identity function. -* -* @param x - input value -* @returns input value -*/ -function identity( x: number ): number { - return x; -} - - -// TESTS // - -// The function returns `undefined`... -{ - const x = array(); - const y = array(); - const arrays = [ x, y ]; - - unary( arrays, identity ); // $ExpectType void -} - -// The compiler throws an error if the function is provided a first argument which is not an array-like object containing ndarray-like objects... -{ - unary( 5, identity ); // $ExpectError - unary( true, identity ); // $ExpectError - unary( false, identity ); // $ExpectError - unary( null, identity ); // $ExpectError - unary( undefined, identity ); // $ExpectError - unary( {}, identity ); // $ExpectError - unary( [ 1 ], identity ); // $ExpectError - unary( ( x: number ): number => x, identity ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a unary function... -{ - const x = array(); - const y = array(); - const arrays = [ x, y ]; - - unary( arrays, '10' ); // $ExpectError - unary( arrays, 5 ); // $ExpectError - unary( arrays, true ); // $ExpectError - unary( arrays, false ); // $ExpectError - unary( arrays, null ); // $ExpectError - unary( arrays, undefined ); // $ExpectError - unary( arrays, [] ); // $ExpectError - unary( arrays, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const x = array(); - const y = array(); - const arrays = [ x, y ]; - - unary(); // $ExpectError - unary( arrays ); // $ExpectError - unary( arrays, identity, 10 ); // $ExpectError -} diff --git a/examples/c/b_b/Makefile b/examples/c/b_b/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/b_b/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/b_b/example.c b/examples/c/b_b/example.c deleted file mode 100644 index 6760bc1..0000000 --- a/examples/c/b_b/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int64_t i; - uint8_t v; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_uint8( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %hhu\n", i, v ); - } -} - -static uint8_t scale( const uint8_t x ) { - return x * 10; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_UINT8; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 4, 2, 1 }; - int64_t sy[] = { 4, 2, 1 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_b_b( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/c_c/Makefile b/examples/c/c_c/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/c_c/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/c_c/example.c b/examples/c/c_c/example.c deleted file mode 100644 index 5d6be37..0000000 --- a/examples/c/c_c/example.c +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - stdlib_complex64_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_complex64( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %f + %fi\n", i, v.re, v.im ); - } -} - -static stdlib_complex64_t scale( const stdlib_complex64_t x ) { - return stdlib_complex64( x.re+10.0f, x.im+10.0f ); -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_COMPLEX64; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 32, 16, 8 }; - int64_t sy[] = { 32, 16, 8 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_c_c( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/c_z/Makefile b/examples/c/c_z/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/c_z/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/c_z/example.c b/examples/c/c_z/example.c deleted file mode 100644 index a29cf76..0000000 --- a/examples/c/c_z/example.c +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - stdlib_complex128_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_complex128( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %lf + %lfi\n", i, v.re, v.im ); - } -} - -static stdlib_complex64_t scale( const stdlib_complex64_t x ) { - return stdlib_complex64( x.re+10.0f, x.im+10.0f ); -} - -int main( void ) { - // Define the ndarray data types: - enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; - enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 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, 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, 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 32, 16, 8 }; - int64_t sy[] = { 64, 32, 16 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_c_z( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/d_d/Makefile b/examples/c/d_d/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/d_d/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/d_d/example.c b/examples/c/d_d/example.c deleted file mode 100644 index ddda7c2..0000000 --- a/examples/c/d_d/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int64_t i; - int8_t s; - double v; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_float64( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %lf\n", i, v ); - } -} - -static double scale( const double x ) { - return x + 10.0; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_FLOAT64; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 32, 16, 8 }; - int64_t sy[] = { 32, 16, 8 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_d_d( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/d_z/Makefile b/examples/c/d_z/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/d_z/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/d_z/example.c b/examples/c/d_z/example.c deleted file mode 100644 index ec5b770..0000000 --- a/examples/c/d_z/example.c +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - stdlib_complex128_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_complex128( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %lf + %lfi\n", i, v.re, v.im ); - } -} - -static double scale( const double x ) { - return x + 10.0; -} - -int main( void ) { - // Define the ndarray data types: - enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; - enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 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, 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, 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 32, 16, 8 }; - int64_t sy[] = { 64, 32, 16 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_d_z( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/d_z_as_z_z/Makefile b/examples/c/d_z_as_z_z/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/d_z_as_z_z/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/d_z_as_z_z/example.c b/examples/c/d_z_as_z_z/example.c deleted file mode 100644 index 10d527c..0000000 --- a/examples/c/d_z_as_z_z/example.c +++ /dev/null @@ -1,113 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - stdlib_complex128_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_complex128( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %lf + %lfi\n", i, v.re, v.im ); - } -} - -static stdlib_complex128_t scale( const stdlib_complex128_t x ) { - return stdlib_complex128( x.re+10.0, x.im+10.0 ); -} - -int main( void ) { - // Define the ndarray data types: - enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; - enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 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, 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, 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 32, 16, 8 }; - int64_t sy[] = { 64, 32, 16 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_d_z_as_z_z( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/f_f/Makefile b/examples/c/f_f/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/f_f/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/f_f/example.c b/examples/c/f_f/example.c deleted file mode 100644 index 9c33fd3..0000000 --- a/examples/c/f_f/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int64_t i; - int8_t s; - float v; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_float32( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %f\n", i, v ); - } -} - -static float scale( const float x ) { - return x + 10.0f; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_FLOAT32; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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 }; - uint8_t ybuf[] = { 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 16, 8, 4 }; - int64_t sy[] = { 16, 8, 4 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_f_f( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/i_i/Makefile b/examples/c/i_i/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/i_i/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/i_i/example.c b/examples/c/i_i/example.c deleted file mode 100644 index 868fa33..0000000 --- a/examples/c/i_i/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int32_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_int32( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %i\n", i, v ); - } -} - -static int32_t scale( const int32_t x ) { - return x + 10; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_INT32; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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 }; - uint8_t ybuf[] = { 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 16, 8, 4 }; - int64_t sy[] = { 16, 8, 4 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_i_i( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/k_k/Makefile b/examples/c/k_k/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/k_k/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/k_k/example.c b/examples/c/k_k/example.c deleted file mode 100644 index 6c550be..0000000 --- a/examples/c/k_k/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int16_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_int16( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %d\n", i, v ); - } -} - -static int16_t scale( const int16_t x ) { - return x + 10; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_INT16; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 8, 4, 2 }; - int64_t sy[] = { 8, 4, 2 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_k_k( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/s_s/Makefile b/examples/c/s_s/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/s_s/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/s_s/example.c b/examples/c/s_s/example.c deleted file mode 100644 index 710e21b..0000000 --- a/examples/c/s_s/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - int64_t i; - int8_t v; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_int8( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %hhi\n", i, v ); - } -} - -static int8_t scale( const int8_t x ) { - return x * 10; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_INT8; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; - uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 4, 2, 1 }; - int64_t sy[] = { 4, 2, 1 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_s_s( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/t_t/Makefile b/examples/c/t_t/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/t_t/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/t_t/example.c b/examples/c/t_t/example.c deleted file mode 100644 index ce7e959..0000000 --- a/examples/c/t_t/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - uint16_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_uint16( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %u\n", i, v ); - } -} - -static uint16_t scale( const uint16_t x ) { - return x + 10; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_UINT16; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 8, 4, 2 }; - int64_t sy[] = { 8, 4, 2 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_t_t( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/u_u/Makefile b/examples/c/u_u/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/u_u/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/u_u/example.c b/examples/c/u_u/example.c deleted file mode 100644 index df7345b..0000000 --- a/examples/c/u_u/example.c +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - uint32_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_uint32( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %u\n", i, v ); - } -} - -static uint32_t scale( const uint32_t x ) { - return x + 10; -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_UINT32; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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 }; - uint8_t ybuf[] = { 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 16, 8, 4 }; - int64_t sy[] = { 16, 8, 4 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_u_u( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/c/z_z/Makefile b/examples/c/z_z/Makefile deleted file mode 100644 index f10799a..0000000 --- a/examples/c/z_z/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT 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 \ - -march=native \ - -flto - -# 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/z_z/example.c b/examples/c/z_z/example.c deleted file mode 100644 index 3e1a077..0000000 --- a/examples/c/z_z/example.c +++ /dev/null @@ -1,112 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary.h" -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include -#include -#include -#include - -static void print_ndarray_contents( const struct ndarray *x ) { - stdlib_complex128_t v; - int64_t i; - int8_t s; - - for ( i = 0; i < stdlib_ndarray_length( x ); i++ ) { - s = stdlib_ndarray_iget_complex128( x, i, &v ); - if ( s != 0 ) { - fprintf( stderr, "Unable to resolve data element.\n" ); - exit( EXIT_FAILURE ); - } - fprintf( stdout, "data[%"PRId64"] = %lf + %lfi\n", i, v.re, v.im ); - } -} - -static stdlib_complex128_t scale( const stdlib_complex128_t x ) { - return stdlib_complex128( x.re+10.0, x.im+10.0 ); -} - -int main( void ) { - // Define the ndarray data type: - enum STDLIB_NDARRAY_DTYPE dtype = STDLIB_NDARRAY_COMPLEX128; - - // Create underlying byte arrays: - uint8_t xbuf[] = { 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, 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, 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 }; - uint8_t ybuf[] = { 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, 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, 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 }; - - // Define the number of dimensions: - int64_t ndims = 3; - - // Define the array shapes: - int64_t shape[] = { 2, 2, 2 }; - - // Define the strides: - int64_t sx[] = { 64, 32, 16 }; - int64_t sy[] = { 64, 32, 16 }; - - // Define the offsets: - int64_t ox = 0; - int64_t oy = 0; - - // Define the array order: - 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[] = { imode }; - int64_t nsubmodes = 1; - - // Create an input ndarray: - struct ndarray *x = stdlib_ndarray_allocate( dtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); - if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Create an output ndarray: - struct ndarray *y = stdlib_ndarray_allocate( dtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); - if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); - } - - // Define an array containing the ndarrays: - struct ndarray *arrays[] = { x, y }; - - // Apply the callback: - int8_t status = stdlib_ndarray_z_z( arrays, (void *)scale ); - if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); - } - - // Print the results: - print_ndarray_contents( y ); - fprintf( stdout, "\n" ); - - // Free allocated memory: - stdlib_ndarray_free( x ); - stdlib_ndarray_free( y ); -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index de63c37..0000000 --- a/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory; -var filledarray = require( '@stdlib/array-filled' ); -var filledarrayBy = require( '@stdlib/array-filled-by' ); -var abs = require( '@stdlib/math-base-special-abs' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var ndarray2array = require( '@stdlib/ndarray-base-to-array' ); -var unary = require( './../lib' ); - -var N = 10; -var x = { - 'dtype': 'generic', - 'data': filledarrayBy( N, 'generic', discreteUniform( -100, 100 ) ), - 'shape': [ 5, 2 ], - 'strides': [ 2, 1 ], - 'offset': 0, - 'order': 'row-major' -}; -var y = { - 'dtype': 'generic', - 'data': filledarray( 0, N, 'generic' ), - 'shape': x.shape.slice(), - 'strides': shape2strides( x.shape, 'column-major' ), - 'offset': 0, - 'order': 'column-major' -}; - -unary( [ x, y ], abs ); -console.log( ndarray2array( x.data, x.shape, x.strides, x.offset, x.order ) ); -console.log( ndarray2array( y.data, y.shape, y.strides, y.offset, y.order ) ); diff --git a/include/stdlib/ndarray/base/unary.h b/include/stdlib/ndarray/base/unary.h deleted file mode 100644 index d9df1c9..0000000 --- a/include/stdlib/ndarray/base/unary.h +++ /dev/null @@ -1,192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/** -* Header file containing function declarations for ndarray functions which apply a unary callback. -*/ -#ifndef STDLIB_NDARRAY_BASE_UNARY_H -#define STDLIB_NDARRAY_BASE_UNARY_H - -#include "unary/macros.h" -#include "unary/typedefs.h" -#include "unary/dispatch_object.h" -#include "unary/dispatch.h" - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -// BEGIN LOOPS -#include "unary/b_b.h" -#include "unary/b_b_as_u_u.h" -#include "unary/b_c.h" -#include "unary/b_c_as_b_c.h" -#include "unary/b_c_as_c_c.h" -#include "unary/b_c_as_z_z.h" -#include "unary/b_d.h" -#include "unary/b_d_as_b_d.h" -#include "unary/b_d_as_d_d.h" -#include "unary/b_f.h" -#include "unary/b_f_as_b_f.h" -#include "unary/b_f_as_d_d.h" -#include "unary/b_f_as_f_f.h" -#include "unary/b_i.h" -#include "unary/b_i_as_b_i.h" -#include "unary/b_i_as_i_i.h" -#include "unary/b_k.h" -#include "unary/b_k_as_b_k.h" -#include "unary/b_k_as_i_i.h" -#include "unary/b_k_as_k_k.h" -#include "unary/b_t.h" -#include "unary/b_t_as_b_t.h" -#include "unary/b_t_as_t_t.h" -#include "unary/b_t_as_u_u.h" -#include "unary/b_u.h" -#include "unary/b_u_as_b_u.h" -#include "unary/b_u_as_u_u.h" -#include "unary/b_z.h" -#include "unary/b_z_as_b_z.h" -#include "unary/b_z_as_z_z.h" - -#include "unary/c_c.h" -#include "unary/c_c_as_z_z.h" -#include "unary/c_f_as_c_f.h" -#include "unary/c_z.h" -#include "unary/c_z_as_c_z.h" -#include "unary/c_z_as_z_z.h" - -#include "unary/d_d.h" -#include "unary/d_i_as_d_i.h" -#include "unary/d_z.h" -#include "unary/d_z_as_d_z.h" -#include "unary/d_z_as_z_z.h" - -#include "unary/f_c.h" -#include "unary/f_c_as_c_c.h" -#include "unary/f_c_as_f_c.h" -#include "unary/f_c_as_z_z.h" -#include "unary/f_d.h" -#include "unary/f_d_as_d_d.h" -#include "unary/f_d_as_f_d.h" -#include "unary/f_f.h" -#include "unary/f_f_as_d_d.h" -#include "unary/f_i_as_f_i.h" -#include "unary/f_z.h" -#include "unary/f_z_as_f_z.h" -#include "unary/f_z_as_z_z.h" - -#include "unary/i_d.h" -#include "unary/i_d_as_d_d.h" -#include "unary/i_d_as_i_d.h" -#include "unary/i_i.h" -#include "unary/i_u.h" -#include "unary/i_z.h" -#include "unary/i_z_as_i_z.h" -#include "unary/i_z_as_z_z.h" - -#include "unary/k_c.h" -#include "unary/k_c_as_c_c.h" -#include "unary/k_c_as_k_c.h" -#include "unary/k_c_as_z_z.h" -#include "unary/k_d.h" -#include "unary/k_d_as_d_d.h" -#include "unary/k_d_as_k_d.h" -#include "unary/k_f.h" -#include "unary/k_f_as_d_d.h" -#include "unary/k_f_as_f_f.h" -#include "unary/k_f_as_k_f.h" -#include "unary/k_i.h" -#include "unary/k_i_as_i_i.h" -#include "unary/k_i_as_k_i.h" -#include "unary/k_k.h" -#include "unary/k_k_as_i_i.h" -#include "unary/k_t.h" -#include "unary/k_t_as_i_i.h" -#include "unary/k_u.h" -#include "unary/k_u_as_i_i.h" -#include "unary/k_z.h" -#include "unary/k_z_as_k_z.h" -#include "unary/k_z_as_z_z.h" - -#include "unary/s_b.h" -#include "unary/s_c.h" -#include "unary/s_c_as_c_c.h" -#include "unary/s_c_as_s_c.h" -#include "unary/s_c_as_z_z.h" -#include "unary/s_d.h" -#include "unary/s_d_as_d_d.h" -#include "unary/s_d_as_s_d.h" -#include "unary/s_f.h" -#include "unary/s_f_as_d_d.h" -#include "unary/s_f_as_f_f.h" -#include "unary/s_f_as_s_f.h" -#include "unary/s_i.h" -#include "unary/s_i_as_i_i.h" -#include "unary/s_i_as_s_i.h" -#include "unary/s_k.h" -#include "unary/s_k_as_i_i.h" -#include "unary/s_k_as_k_k.h" -#include "unary/s_k_as_s_k.h" -#include "unary/s_s.h" -#include "unary/s_s_as_i_i.h" -#include "unary/s_t.h" -#include "unary/s_t_as_i_i.h" -#include "unary/s_u.h" -#include "unary/s_u_as_i_i.h" -#include "unary/s_z.h" -#include "unary/s_z_as_s_z.h" -#include "unary/s_z_as_z_z.h" - -#include "unary/t_c.h" -#include "unary/t_c_as_c_c.h" -#include "unary/t_c_as_t_c.h" -#include "unary/t_c_as_z_z.h" -#include "unary/t_d.h" -#include "unary/t_d_as_d_d.h" -#include "unary/t_d_as_t_d.h" -#include "unary/t_f.h" -#include "unary/t_f_as_d_d.h" -#include "unary/t_f_as_f_f.h" -#include "unary/t_f_as_t_f.h" -#include "unary/t_i.h" -#include "unary/t_i_as_i_i.h" -#include "unary/t_i_as_t_i.h" -#include "unary/t_t.h" -#include "unary/t_t_as_u_u.h" -#include "unary/t_u.h" -#include "unary/t_u_as_t_u.h" -#include "unary/t_u_as_u_u.h" -#include "unary/t_z.h" -#include "unary/t_z_as_t_z.h" -#include "unary/t_z_as_z_z.h" - -#include "unary/u_d.h" -#include "unary/u_d_as_d_d.h" -#include "unary/u_d_as_u_d.h" -#include "unary/u_u.h" -#include "unary/u_z.h" -#include "unary/u_z_as_u_z.h" -#include "unary/u_z_as_z_z.h" - -#include "unary/x_x.h" - -#include "unary/z_d_as_z_d.h" -#include "unary/z_z.h" -// END LOOPS - -#endif // !STDLIB_NDARRAY_BASE_UNARY_H diff --git a/include/stdlib/ndarray/base/unary/b_b.h b/include/stdlib/ndarray/base/unary/b_b.h deleted file mode 100644 index 3133f03..0000000 --- a/include/stdlib/ndarray/base/unary/b_b.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_B_H -#define STDLIB_NDARRAY_BASE_UNARY_B_B_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_b( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_B_H diff --git a/include/stdlib/ndarray/base/unary/b_b_as_u_u.h b/include/stdlib/ndarray/base/unary/b_b_as_u_u.h deleted file mode 100644 index 1ae664a..0000000 --- a/include/stdlib/ndarray/base/unary/b_b_as_u_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_B_AS_U_U_H -#define STDLIB_NDARRAY_BASE_UNARY_B_B_AS_U_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_b_as_u_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_B_AS_U_U_H diff --git a/include/stdlib/ndarray/base/unary/b_c.h b/include/stdlib/ndarray/base/unary/b_c.h deleted file mode 100644 index d2f276f..0000000 --- a/include/stdlib/ndarray/base/unary/b_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_C_H -#define STDLIB_NDARRAY_BASE_UNARY_B_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_C_H diff --git a/include/stdlib/ndarray/base/unary/b_c_as_b_c.h b/include/stdlib/ndarray/base/unary/b_c_as_b_c.h deleted file mode 100644 index b264545..0000000 --- a/include/stdlib/ndarray/base/unary/b_c_as_b_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_C_AS_B_C_H -#define STDLIB_NDARRAY_BASE_UNARY_B_C_AS_B_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_b_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_C_AS_B_C_H diff --git a/include/stdlib/ndarray/base/unary/b_c_as_c_c.h b/include/stdlib/ndarray/base/unary/b_c_as_c_c.h deleted file mode 100644 index bcd797a..0000000 --- a/include/stdlib/ndarray/base/unary/b_c_as_c_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_C_AS_C_C_H -#define STDLIB_NDARRAY_BASE_UNARY_B_C_AS_C_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_C_AS_C_C_H diff --git a/include/stdlib/ndarray/base/unary/b_c_as_z_z.h b/include/stdlib/ndarray/base/unary/b_c_as_z_z.h deleted file mode 100644 index bc7a327..0000000 --- a/include/stdlib/ndarray/base/unary/b_c_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_C_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_B_C_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_C_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/b_d.h b/include/stdlib/ndarray/base/unary/b_d.h deleted file mode 100644 index 099db66..0000000 --- a/include/stdlib/ndarray/base/unary/b_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_D_H -#define STDLIB_NDARRAY_BASE_UNARY_B_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_D_H diff --git a/include/stdlib/ndarray/base/unary/b_d_as_b_d.h b/include/stdlib/ndarray/base/unary/b_d_as_b_d.h deleted file mode 100644 index f4e3766..0000000 --- a/include/stdlib/ndarray/base/unary/b_d_as_b_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_D_AS_B_D_H -#define STDLIB_NDARRAY_BASE_UNARY_B_D_AS_B_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_b_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_D_AS_B_D_H diff --git a/include/stdlib/ndarray/base/unary/b_d_as_d_d.h b/include/stdlib/ndarray/base/unary/b_d_as_d_d.h deleted file mode 100644 index cde16ce..0000000 --- a/include/stdlib/ndarray/base/unary/b_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_B_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/b_f.h b/include/stdlib/ndarray/base/unary/b_f.h deleted file mode 100644 index 90d47a2..0000000 --- a/include/stdlib/ndarray/base/unary/b_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_F_H -#define STDLIB_NDARRAY_BASE_UNARY_B_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_F_H diff --git a/include/stdlib/ndarray/base/unary/b_f_as_b_f.h b/include/stdlib/ndarray/base/unary/b_f_as_b_f.h deleted file mode 100644 index d19dcc6..0000000 --- a/include/stdlib/ndarray/base/unary/b_f_as_b_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_F_AS_B_F_H -#define STDLIB_NDARRAY_BASE_UNARY_B_F_AS_B_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_b_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_F_AS_B_F_H diff --git a/include/stdlib/ndarray/base/unary/b_f_as_d_d.h b/include/stdlib/ndarray/base/unary/b_f_as_d_d.h deleted file mode 100644 index 3ec20d4..0000000 --- a/include/stdlib/ndarray/base/unary/b_f_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_F_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_B_F_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_F_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/b_f_as_f_f.h b/include/stdlib/ndarray/base/unary/b_f_as_f_f.h deleted file mode 100644 index b5a5726..0000000 --- a/include/stdlib/ndarray/base/unary/b_f_as_f_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_F_AS_F_F_H -#define STDLIB_NDARRAY_BASE_UNARY_B_F_AS_F_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_F_AS_F_F_H diff --git a/include/stdlib/ndarray/base/unary/b_i.h b/include/stdlib/ndarray/base/unary/b_i.h deleted file mode 100644 index bda74d3..0000000 --- a/include/stdlib/ndarray/base/unary/b_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_I_H -#define STDLIB_NDARRAY_BASE_UNARY_B_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_I_H diff --git a/include/stdlib/ndarray/base/unary/b_i_as_b_i.h b/include/stdlib/ndarray/base/unary/b_i_as_b_i.h deleted file mode 100644 index 04ca8c0..0000000 --- a/include/stdlib/ndarray/base/unary/b_i_as_b_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_I_AS_B_I_H -#define STDLIB_NDARRAY_BASE_UNARY_B_I_AS_B_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_b_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_I_AS_B_I_H diff --git a/include/stdlib/ndarray/base/unary/b_i_as_i_i.h b/include/stdlib/ndarray/base/unary/b_i_as_i_i.h deleted file mode 100644 index 9ea21e4..0000000 --- a/include/stdlib/ndarray/base/unary/b_i_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_I_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_B_I_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_I_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/b_k.h b/include/stdlib/ndarray/base/unary/b_k.h deleted file mode 100644 index 10820bc..0000000 --- a/include/stdlib/ndarray/base/unary/b_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_K_H -#define STDLIB_NDARRAY_BASE_UNARY_B_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_K_H diff --git a/include/stdlib/ndarray/base/unary/b_k_as_b_k.h b/include/stdlib/ndarray/base/unary/b_k_as_b_k.h deleted file mode 100644 index 1b9cf2a..0000000 --- a/include/stdlib/ndarray/base/unary/b_k_as_b_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_K_AS_B_K_H -#define STDLIB_NDARRAY_BASE_UNARY_B_K_AS_B_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_b_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_K_AS_B_K_H diff --git a/include/stdlib/ndarray/base/unary/b_k_as_i_i.h b/include/stdlib/ndarray/base/unary/b_k_as_i_i.h deleted file mode 100644 index ef863c7..0000000 --- a/include/stdlib/ndarray/base/unary/b_k_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_K_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_B_K_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_K_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/b_k_as_k_k.h b/include/stdlib/ndarray/base/unary/b_k_as_k_k.h deleted file mode 100644 index 9a56278..0000000 --- a/include/stdlib/ndarray/base/unary/b_k_as_k_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_K_AS_K_K_H -#define STDLIB_NDARRAY_BASE_UNARY_B_K_AS_K_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_k_as_k_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_K_AS_K_K_H diff --git a/include/stdlib/ndarray/base/unary/b_t.h b/include/stdlib/ndarray/base/unary/b_t.h deleted file mode 100644 index 69a1f26..0000000 --- a/include/stdlib/ndarray/base/unary/b_t.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_T_H -#define STDLIB_NDARRAY_BASE_UNARY_B_T_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_t( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_T_H diff --git a/include/stdlib/ndarray/base/unary/b_t_as_b_t.h b/include/stdlib/ndarray/base/unary/b_t_as_b_t.h deleted file mode 100644 index 3ffc7b7..0000000 --- a/include/stdlib/ndarray/base/unary/b_t_as_b_t.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_T_AS_B_T_H -#define STDLIB_NDARRAY_BASE_UNARY_B_T_AS_B_T_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_b_t_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_T_AS_B_T_H diff --git a/include/stdlib/ndarray/base/unary/b_t_as_t_t.h b/include/stdlib/ndarray/base/unary/b_t_as_t_t.h deleted file mode 100644 index 20a91da..0000000 --- a/include/stdlib/ndarray/base/unary/b_t_as_t_t.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_T_AS_T_T_H -#define STDLIB_NDARRAY_BASE_UNARY_B_T_AS_T_T_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_t_t_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_T_AS_T_T_H diff --git a/include/stdlib/ndarray/base/unary/b_t_as_u_u.h b/include/stdlib/ndarray/base/unary/b_t_as_u_u.h deleted file mode 100644 index 4c38e8e..0000000 --- a/include/stdlib/ndarray/base/unary/b_t_as_u_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_T_AS_U_U_H -#define STDLIB_NDARRAY_BASE_UNARY_B_T_AS_U_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_t_as_u_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_T_AS_U_U_H diff --git a/include/stdlib/ndarray/base/unary/b_u.h b/include/stdlib/ndarray/base/unary/b_u.h deleted file mode 100644 index 239e602..0000000 --- a/include/stdlib/ndarray/base/unary/b_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_U_H -#define STDLIB_NDARRAY_BASE_UNARY_B_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_U_H diff --git a/include/stdlib/ndarray/base/unary/b_u_as_b_u.h b/include/stdlib/ndarray/base/unary/b_u_as_b_u.h deleted file mode 100644 index 11402c8..0000000 --- a/include/stdlib/ndarray/base/unary/b_u_as_b_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_U_AS_B_U_H -#define STDLIB_NDARRAY_BASE_UNARY_B_U_AS_B_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_b_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_U_AS_B_U_H diff --git a/include/stdlib/ndarray/base/unary/b_u_as_u_u.h b/include/stdlib/ndarray/base/unary/b_u_as_u_u.h deleted file mode 100644 index 436c56c..0000000 --- a/include/stdlib/ndarray/base/unary/b_u_as_u_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_U_AS_U_U_H -#define STDLIB_NDARRAY_BASE_UNARY_B_U_AS_U_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_u_as_u_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_U_AS_U_U_H diff --git a/include/stdlib/ndarray/base/unary/b_z.h b/include/stdlib/ndarray/base/unary/b_z.h deleted file mode 100644 index 291c7bf..0000000 --- a/include/stdlib/ndarray/base/unary/b_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_B_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_Z_H diff --git a/include/stdlib/ndarray/base/unary/b_z_as_b_z.h b/include/stdlib/ndarray/base/unary/b_z_as_b_z.h deleted file mode 100644 index 66fe1c1..0000000 --- a/include/stdlib/ndarray/base/unary/b_z_as_b_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_Z_AS_B_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_B_Z_AS_B_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_b_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_Z_AS_B_Z_H diff --git a/include/stdlib/ndarray/base/unary/b_z_as_z_z.h b/include/stdlib/ndarray/base/unary/b_z_as_z_z.h deleted file mode 100644 index b41909f..0000000 --- a/include/stdlib/ndarray/base/unary/b_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_B_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_B_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_b_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_B_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/c_c.h b/include/stdlib/ndarray/base/unary/c_c.h deleted file mode 100644 index 6a2e04a..0000000 --- a/include/stdlib/ndarray/base/unary/c_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_C_C_H -#define STDLIB_NDARRAY_BASE_UNARY_C_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_c_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_C_C_H diff --git a/include/stdlib/ndarray/base/unary/c_c_as_z_z.h b/include/stdlib/ndarray/base/unary/c_c_as_z_z.h deleted file mode 100644 index 9255411..0000000 --- a/include/stdlib/ndarray/base/unary/c_c_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_C_C_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_C_C_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_C_C_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/c_f_as_c_f.h b/include/stdlib/ndarray/base/unary/c_f_as_c_f.h deleted file mode 100644 index 674e69e..0000000 --- a/include/stdlib/ndarray/base/unary/c_f_as_c_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_C_F_AS_C_F_H -#define STDLIB_NDARRAY_BASE_UNARY_C_F_AS_C_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_f_as_c_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_C_F_AS_C_F_H diff --git a/include/stdlib/ndarray/base/unary/c_z.h b/include/stdlib/ndarray/base/unary/c_z.h deleted file mode 100644 index 2edd191..0000000 --- a/include/stdlib/ndarray/base/unary/c_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_C_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_C_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_c_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_C_Z_H diff --git a/include/stdlib/ndarray/base/unary/c_z_as_c_z.h b/include/stdlib/ndarray/base/unary/c_z_as_c_z.h deleted file mode 100644 index b419f39..0000000 --- a/include/stdlib/ndarray/base/unary/c_z_as_c_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_C_Z_AS_C_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_C_Z_AS_C_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_c_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_C_Z_AS_C_Z_H diff --git a/include/stdlib/ndarray/base/unary/c_z_as_z_z.h b/include/stdlib/ndarray/base/unary/c_z_as_z_z.h deleted file mode 100644 index 56b9b83..0000000 --- a/include/stdlib/ndarray/base/unary/c_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_C_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_C_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_c_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_C_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/d_d.h b/include/stdlib/ndarray/base/unary/d_d.h deleted file mode 100644 index 1af842e..0000000 --- a/include/stdlib/ndarray/base/unary/d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_D_D_H diff --git a/include/stdlib/ndarray/base/unary/d_i_as_d_i.h b/include/stdlib/ndarray/base/unary/d_i_as_d_i.h deleted file mode 100644 index 8a08d64..0000000 --- a/include/stdlib/ndarray/base/unary/d_i_as_d_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_D_I_AS_D_I_H -#define STDLIB_NDARRAY_BASE_UNARY_D_I_AS_D_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_i_as_d_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_D_I_AS_D_I_H diff --git a/include/stdlib/ndarray/base/unary/d_z.h b/include/stdlib/ndarray/base/unary/d_z.h deleted file mode 100644 index 07fa077..0000000 --- a/include/stdlib/ndarray/base/unary/d_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_D_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_D_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_d_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_D_Z_H diff --git a/include/stdlib/ndarray/base/unary/d_z_as_d_z.h b/include/stdlib/ndarray/base/unary/d_z_as_d_z.h deleted file mode 100644 index 8c466e1..0000000 --- a/include/stdlib/ndarray/base/unary/d_z_as_d_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_D_Z_AS_D_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_D_Z_AS_D_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_d_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_D_Z_AS_D_Z_H diff --git a/include/stdlib/ndarray/base/unary/d_z_as_z_z.h b/include/stdlib/ndarray/base/unary/d_z_as_z_z.h deleted file mode 100644 index 06986e1..0000000 --- a/include/stdlib/ndarray/base/unary/d_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_D_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_D_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_d_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_D_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/dispatch.h b/include/stdlib/ndarray/base/unary/dispatch.h deleted file mode 100644 index b64a737..0000000 --- a/include/stdlib/ndarray/base/unary/dispatch.h +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_DISPATCH_H -#define STDLIB_NDARRAY_BASE_UNARY_DISPATCH_H - -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Dispatches to a unary ndarray function according to the dimensionality of provided ndarray arguments. -*/ -int8_t stdlib_ndarray_unary_dispatch( const struct ndarrayUnaryDispatchObject *obj, struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_DISPATCH_H diff --git a/include/stdlib/ndarray/base/unary/dispatch_object.h b/include/stdlib/ndarray/base/unary/dispatch_object.h deleted file mode 100644 index 3f355dd..0000000 --- a/include/stdlib/ndarray/base/unary/dispatch_object.h +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_DISPATCH_OBJECT_H -#define STDLIB_NDARRAY_BASE_UNARY_DISPATCH_OBJECT_H - -#include "stdlib/ndarray/base/unary/typedefs.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Structure for grouping unary function dispatch information. -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include -* #include -* -* ndarrayUnaryFcn functions[] = { -* stdlib_ndarray_b_b_0d, -* stdlib_ndarray_b_b_1d, -* stdlib_ndarray_b_b_2d, -* stdlib_ndarray_b_b_3d, -* stdlib_ndarray_b_b_4d, -* stdlib_ndarray_b_b_5d, -* stdlib_ndarray_b_b_6d, -* stdlib_ndarray_b_b_7d, -* stdlib_ndarray_b_b_8d, -* stdlib_ndarray_b_b_9d, -* stdlib_ndarray_b_b_10d -* stdlib_ndarray_b_b_nd -* }; - -* ndarrayUnaryFcn blocked_functions[] = { -* stdlib_ndarray_b_b_2d_blocked, -* stdlib_ndarray_b_b_3d_blocked, -* stdlib_ndarray_b_b_4d_blocked, -* stdlib_ndarray_b_b_5d_blocked, -* stdlib_ndarray_b_b_6d_blocked, -* stdlib_ndarray_b_b_7d_blocked, -* stdlib_ndarray_b_b_8d_blocked, -* stdlib_ndarray_b_b_9d_blocked, -* stdlib_ndarray_b_b_10d_blocked -* }; -* -* ndarrayUnaryDispatchObject obj = { -* functions, -* 12, -* blocked_functions -* 9 -* }; -* -* // ... -*/ -struct ndarrayUnaryDispatchObject { - // Array containing unary ndarray functions for performing element-wise computation: - ndarrayUnaryFcn *functions; - - // Number of unary ndarray functions: - int32_t nfunctions; - - // Array containing unary ndarray functions for performing element-wise computation using loop blocking: - ndarrayUnaryFcn *blocked_functions; - - // Number of blocked unary ndarray functions: - int32_t nblockedfunctions; -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_DISPATCH_OBJECT_H diff --git a/include/stdlib/ndarray/base/unary/f_c.h b/include/stdlib/ndarray/base/unary/f_c.h deleted file mode 100644 index 74b9f92..0000000 --- a/include/stdlib/ndarray/base/unary/f_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_C_H -#define STDLIB_NDARRAY_BASE_UNARY_F_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_C_H diff --git a/include/stdlib/ndarray/base/unary/f_c_as_c_c.h b/include/stdlib/ndarray/base/unary/f_c_as_c_c.h deleted file mode 100644 index 14f9eda..0000000 --- a/include/stdlib/ndarray/base/unary/f_c_as_c_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_C_AS_C_C_H -#define STDLIB_NDARRAY_BASE_UNARY_F_C_AS_C_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_C_AS_C_C_H diff --git a/include/stdlib/ndarray/base/unary/f_c_as_f_c.h b/include/stdlib/ndarray/base/unary/f_c_as_f_c.h deleted file mode 100644 index 6372737..0000000 --- a/include/stdlib/ndarray/base/unary/f_c_as_f_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_C_AS_F_C_H -#define STDLIB_NDARRAY_BASE_UNARY_F_C_AS_F_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_f_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_C_AS_F_C_H diff --git a/include/stdlib/ndarray/base/unary/f_c_as_z_z.h b/include/stdlib/ndarray/base/unary/f_c_as_z_z.h deleted file mode 100644 index 91be638..0000000 --- a/include/stdlib/ndarray/base/unary/f_c_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_C_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_F_C_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_C_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/f_d.h b/include/stdlib/ndarray/base/unary/f_d.h deleted file mode 100644 index 510bbe0..0000000 --- a/include/stdlib/ndarray/base/unary/f_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_D_H -#define STDLIB_NDARRAY_BASE_UNARY_F_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_D_H diff --git a/include/stdlib/ndarray/base/unary/f_d_as_d_d.h b/include/stdlib/ndarray/base/unary/f_d_as_d_d.h deleted file mode 100644 index 99633c9..0000000 --- a/include/stdlib/ndarray/base/unary/f_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_F_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/f_d_as_f_d.h b/include/stdlib/ndarray/base/unary/f_d_as_f_d.h deleted file mode 100644 index d5f0612..0000000 --- a/include/stdlib/ndarray/base/unary/f_d_as_f_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_D_AS_F_D_H -#define STDLIB_NDARRAY_BASE_UNARY_F_D_AS_F_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_d_as_f_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_D_AS_F_D_H diff --git a/include/stdlib/ndarray/base/unary/f_f.h b/include/stdlib/ndarray/base/unary/f_f.h deleted file mode 100644 index 86d87d7..0000000 --- a/include/stdlib/ndarray/base/unary/f_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_F_H -#define STDLIB_NDARRAY_BASE_UNARY_F_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_F_H diff --git a/include/stdlib/ndarray/base/unary/f_f_as_d_d.h b/include/stdlib/ndarray/base/unary/f_f_as_d_d.h deleted file mode 100644 index 6c315bc..0000000 --- a/include/stdlib/ndarray/base/unary/f_f_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_F_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_F_F_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_F_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/f_i_as_f_i.h b/include/stdlib/ndarray/base/unary/f_i_as_f_i.h deleted file mode 100644 index f809ec0..0000000 --- a/include/stdlib/ndarray/base/unary/f_i_as_f_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_I_AS_F_I_H -#define STDLIB_NDARRAY_BASE_UNARY_F_I_AS_F_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_i_as_f_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_I_AS_F_I_H diff --git a/include/stdlib/ndarray/base/unary/f_z.h b/include/stdlib/ndarray/base/unary/f_z.h deleted file mode 100644 index 3966ddc..0000000 --- a/include/stdlib/ndarray/base/unary/f_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_F_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_Z_H diff --git a/include/stdlib/ndarray/base/unary/f_z_as_f_z.h b/include/stdlib/ndarray/base/unary/f_z_as_f_z.h deleted file mode 100644 index 8a5b521..0000000 --- a/include/stdlib/ndarray/base/unary/f_z_as_f_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_Z_AS_F_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_F_Z_AS_F_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_f_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_Z_AS_F_Z_H diff --git a/include/stdlib/ndarray/base/unary/f_z_as_z_z.h b/include/stdlib/ndarray/base/unary/f_z_as_z_z.h deleted file mode 100644 index dd95228..0000000 --- a/include/stdlib/ndarray/base/unary/f_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_F_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_F_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_f_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_F_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/i_d.h b/include/stdlib/ndarray/base/unary/i_d.h deleted file mode 100644 index cbec373..0000000 --- a/include/stdlib/ndarray/base/unary/i_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_D_H -#define STDLIB_NDARRAY_BASE_UNARY_I_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_D_H diff --git a/include/stdlib/ndarray/base/unary/i_d_as_d_d.h b/include/stdlib/ndarray/base/unary/i_d_as_d_d.h deleted file mode 100644 index 9d67e8f..0000000 --- a/include/stdlib/ndarray/base/unary/i_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_I_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/i_d_as_i_d.h b/include/stdlib/ndarray/base/unary/i_d_as_i_d.h deleted file mode 100644 index c27e2a2..0000000 --- a/include/stdlib/ndarray/base/unary/i_d_as_i_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_D_AS_I_D_H -#define STDLIB_NDARRAY_BASE_UNARY_I_D_AS_I_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_d_as_i_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_D_AS_I_D_H diff --git a/include/stdlib/ndarray/base/unary/i_i.h b/include/stdlib/ndarray/base/unary/i_i.h deleted file mode 100644 index 6350184..0000000 --- a/include/stdlib/ndarray/base/unary/i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_I_H diff --git a/include/stdlib/ndarray/base/unary/i_u.h b/include/stdlib/ndarray/base/unary/i_u.h deleted file mode 100644 index 569348d..0000000 --- a/include/stdlib/ndarray/base/unary/i_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_U_H -#define STDLIB_NDARRAY_BASE_UNARY_I_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_U_H diff --git a/include/stdlib/ndarray/base/unary/i_z.h b/include/stdlib/ndarray/base/unary/i_z.h deleted file mode 100644 index d072e03..0000000 --- a/include/stdlib/ndarray/base/unary/i_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_I_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_Z_H diff --git a/include/stdlib/ndarray/base/unary/i_z_as_i_z.h b/include/stdlib/ndarray/base/unary/i_z_as_i_z.h deleted file mode 100644 index 3f4d9c3..0000000 --- a/include/stdlib/ndarray/base/unary/i_z_as_i_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_Z_AS_I_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_I_Z_AS_I_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_i_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_Z_AS_I_Z_H diff --git a/include/stdlib/ndarray/base/unary/i_z_as_z_z.h b/include/stdlib/ndarray/base/unary/i_z_as_z_z.h deleted file mode 100644 index b280d6b..0000000 --- a/include/stdlib/ndarray/base/unary/i_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_I_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_I_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_i_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_I_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/internal/permute.h b/include/stdlib/ndarray/base/unary/internal/permute.h deleted file mode 100644 index 21e681c..0000000 --- a/include/stdlib/ndarray/base/unary/internal/permute.h +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_INTERNAL_PERMUTE_H -#define STDLIB_NDARRAY_BASE_UNARY_INTERNAL_PERMUTE_H - -#include - -/** -* Permutes an input array according to a provided index array. -*/ -void stdlib_ndarray_base_unary_internal_permute( const int64_t n, const int64_t *arr, const int64_t *idx, int64_t *out ); - -#endif // !STDLIB_NDARRAY_BASE_UNARY_INTERNAL_PERMUTE_H diff --git a/include/stdlib/ndarray/base/unary/internal/range.h b/include/stdlib/ndarray/base/unary/internal/range.h deleted file mode 100644 index 7b4ca9b..0000000 --- a/include/stdlib/ndarray/base/unary/internal/range.h +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_INTERNAL_RANGE_H -#define STDLIB_NDARRAY_BASE_UNARY_INTERNAL_RANGE_H - -#include - -/** -* Writes `n` evenly spaced values from `0` to `n-1` to an output array. -*/ -void stdlib_ndarray_base_unary_internal_range( const int64_t n, int64_t *out ); - -#endif // !STDLIB_NDARRAY_BASE_UNARY_INTERNAL_RANGE_H diff --git a/include/stdlib/ndarray/base/unary/internal/sort2ins.h b/include/stdlib/ndarray/base/unary/internal/sort2ins.h deleted file mode 100644 index d598550..0000000 --- a/include/stdlib/ndarray/base/unary/internal/sort2ins.h +++ /dev/null @@ -1,29 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_INTERNAL_SORT2INS_H -#define STDLIB_NDARRAY_BASE_UNARY_INTERNAL_SORT2INS_H - -#include - -/** -* Simultaneously sorts two arrays based on the sort order of the first array using insertion sort. -*/ -void stdlib_ndarray_base_unary_internal_sort2ins( const int64_t n, int64_t *x, int64_t *y ); - -#endif // !STDLIB_NDARRAY_BASE_UNARY_INTERNAL_SORT2INS_H diff --git a/include/stdlib/ndarray/base/unary/k_c.h b/include/stdlib/ndarray/base/unary/k_c.h deleted file mode 100644 index e70254d..0000000 --- a/include/stdlib/ndarray/base/unary/k_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_C_H -#define STDLIB_NDARRAY_BASE_UNARY_K_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_C_H diff --git a/include/stdlib/ndarray/base/unary/k_c_as_c_c.h b/include/stdlib/ndarray/base/unary/k_c_as_c_c.h deleted file mode 100644 index 530ae14..0000000 --- a/include/stdlib/ndarray/base/unary/k_c_as_c_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_C_AS_C_C_H -#define STDLIB_NDARRAY_BASE_UNARY_K_C_AS_C_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_C_AS_C_C_H diff --git a/include/stdlib/ndarray/base/unary/k_c_as_k_c.h b/include/stdlib/ndarray/base/unary/k_c_as_k_c.h deleted file mode 100644 index e4e1b81..0000000 --- a/include/stdlib/ndarray/base/unary/k_c_as_k_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_C_AS_K_C_H -#define STDLIB_NDARRAY_BASE_UNARY_K_C_AS_K_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_k_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_C_AS_K_C_H diff --git a/include/stdlib/ndarray/base/unary/k_c_as_z_z.h b/include/stdlib/ndarray/base/unary/k_c_as_z_z.h deleted file mode 100644 index 59b4d7d..0000000 --- a/include/stdlib/ndarray/base/unary/k_c_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_C_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_K_C_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_C_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/k_d.h b/include/stdlib/ndarray/base/unary/k_d.h deleted file mode 100644 index 417fc26..0000000 --- a/include/stdlib/ndarray/base/unary/k_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_D_H -#define STDLIB_NDARRAY_BASE_UNARY_K_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_D_H diff --git a/include/stdlib/ndarray/base/unary/k_d_as_d_d.h b/include/stdlib/ndarray/base/unary/k_d_as_d_d.h deleted file mode 100644 index 048a081..0000000 --- a/include/stdlib/ndarray/base/unary/k_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_K_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/k_d_as_k_d.h b/include/stdlib/ndarray/base/unary/k_d_as_k_d.h deleted file mode 100644 index fd4c255..0000000 --- a/include/stdlib/ndarray/base/unary/k_d_as_k_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_D_AS_K_D_H -#define STDLIB_NDARRAY_BASE_UNARY_K_D_AS_K_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_d_as_k_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_D_AS_K_D_H diff --git a/include/stdlib/ndarray/base/unary/k_f.h b/include/stdlib/ndarray/base/unary/k_f.h deleted file mode 100644 index 1c8bf20..0000000 --- a/include/stdlib/ndarray/base/unary/k_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_F_H -#define STDLIB_NDARRAY_BASE_UNARY_K_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_F_H diff --git a/include/stdlib/ndarray/base/unary/k_f_as_d_d.h b/include/stdlib/ndarray/base/unary/k_f_as_d_d.h deleted file mode 100644 index b6241a7..0000000 --- a/include/stdlib/ndarray/base/unary/k_f_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_F_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_K_F_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_F_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/k_f_as_f_f.h b/include/stdlib/ndarray/base/unary/k_f_as_f_f.h deleted file mode 100644 index 7c917e1..0000000 --- a/include/stdlib/ndarray/base/unary/k_f_as_f_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_F_AS_F_F_H -#define STDLIB_NDARRAY_BASE_UNARY_K_F_AS_F_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_F_AS_F_F_H diff --git a/include/stdlib/ndarray/base/unary/k_f_as_k_f.h b/include/stdlib/ndarray/base/unary/k_f_as_k_f.h deleted file mode 100644 index 026f827..0000000 --- a/include/stdlib/ndarray/base/unary/k_f_as_k_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_F_AS_K_F_H -#define STDLIB_NDARRAY_BASE_UNARY_K_F_AS_K_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_f_as_k_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_F_AS_K_F_H diff --git a/include/stdlib/ndarray/base/unary/k_i.h b/include/stdlib/ndarray/base/unary/k_i.h deleted file mode 100644 index 505d879..0000000 --- a/include/stdlib/ndarray/base/unary/k_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_I_H -#define STDLIB_NDARRAY_BASE_UNARY_K_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_I_H diff --git a/include/stdlib/ndarray/base/unary/k_i_as_i_i.h b/include/stdlib/ndarray/base/unary/k_i_as_i_i.h deleted file mode 100644 index 4fc5b0e..0000000 --- a/include/stdlib/ndarray/base/unary/k_i_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_I_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_K_I_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_I_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/k_i_as_k_i.h b/include/stdlib/ndarray/base/unary/k_i_as_k_i.h deleted file mode 100644 index 006bb25..0000000 --- a/include/stdlib/ndarray/base/unary/k_i_as_k_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_I_AS_K_I_H -#define STDLIB_NDARRAY_BASE_UNARY_K_I_AS_K_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_i_as_k_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_I_AS_K_I_H diff --git a/include/stdlib/ndarray/base/unary/k_k.h b/include/stdlib/ndarray/base/unary/k_k.h deleted file mode 100644 index b2683ef..0000000 --- a/include/stdlib/ndarray/base/unary/k_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_K_H -#define STDLIB_NDARRAY_BASE_UNARY_K_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_K_H diff --git a/include/stdlib/ndarray/base/unary/k_k_as_i_i.h b/include/stdlib/ndarray/base/unary/k_k_as_i_i.h deleted file mode 100644 index 39f8103..0000000 --- a/include/stdlib/ndarray/base/unary/k_k_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_K_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_K_K_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_k_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_K_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/k_t.h b/include/stdlib/ndarray/base/unary/k_t.h deleted file mode 100644 index b25aebe..0000000 --- a/include/stdlib/ndarray/base/unary/k_t.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_T_H -#define STDLIB_NDARRAY_BASE_UNARY_K_T_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_t( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_T_H diff --git a/include/stdlib/ndarray/base/unary/k_t_as_i_i.h b/include/stdlib/ndarray/base/unary/k_t_as_i_i.h deleted file mode 100644 index 7660177..0000000 --- a/include/stdlib/ndarray/base/unary/k_t_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_T_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_K_T_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_t_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_T_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/k_u.h b/include/stdlib/ndarray/base/unary/k_u.h deleted file mode 100644 index 189e982..0000000 --- a/include/stdlib/ndarray/base/unary/k_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_U_H -#define STDLIB_NDARRAY_BASE_UNARY_K_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_U_H diff --git a/include/stdlib/ndarray/base/unary/k_u_as_i_i.h b/include/stdlib/ndarray/base/unary/k_u_as_i_i.h deleted file mode 100644 index 12a8f48..0000000 --- a/include/stdlib/ndarray/base/unary/k_u_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_U_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_K_U_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_u_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_U_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/k_z.h b/include/stdlib/ndarray/base/unary/k_z.h deleted file mode 100644 index 3f8a47b..0000000 --- a/include/stdlib/ndarray/base/unary/k_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_K_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_Z_H diff --git a/include/stdlib/ndarray/base/unary/k_z_as_k_z.h b/include/stdlib/ndarray/base/unary/k_z_as_k_z.h deleted file mode 100644 index b38d7ec..0000000 --- a/include/stdlib/ndarray/base/unary/k_z_as_k_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_Z_AS_K_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_K_Z_AS_K_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_k_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_Z_AS_K_Z_H diff --git a/include/stdlib/ndarray/base/unary/k_z_as_z_z.h b/include/stdlib/ndarray/base/unary/k_z_as_z_z.h deleted file mode 100644 index a2f7e07..0000000 --- a/include/stdlib/ndarray/base/unary/k_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_K_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_K_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_k_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_K_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/macros.h b/include/stdlib/ndarray/base/unary/macros.h deleted file mode 100644 index 8139186..0000000 --- a/include/stdlib/ndarray/base/unary/macros.h +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/macros/1d.h" -#include "stdlib/ndarray/base/unary/macros/2d.h" -#include "stdlib/ndarray/base/unary/macros/2d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/3d.h" -#include "stdlib/ndarray/base/unary/macros/3d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/4d.h" -#include "stdlib/ndarray/base/unary/macros/4d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/5d.h" -#include "stdlib/ndarray/base/unary/macros/5d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/6d.h" -#include "stdlib/ndarray/base/unary/macros/6d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/7d.h" -#include "stdlib/ndarray/base/unary/macros/7d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/8d.h" -#include "stdlib/ndarray/base/unary/macros/8d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/9d.h" -#include "stdlib/ndarray/base/unary/macros/9d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/10d.h" -#include "stdlib/ndarray/base/unary/macros/10d_blocked.h" -#include "stdlib/ndarray/base/unary/macros/nd.h" - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_H diff --git a/include/stdlib/ndarray/base/unary/macros/10d.h b/include/stdlib/ndarray/base/unary/macros/10d.h deleted file mode 100644 index 42d0e5c..0000000 --- a/include/stdlib/ndarray/base/unary/macros/10d.h +++ /dev/null @@ -1,521 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_10D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_10D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a ten-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_10D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d9x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t d9x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t S7; \ - int64_t S8; \ - int64_t S9; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - int64_t i9; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 9 ]; \ - S1 = shape[ 8 ]; \ - S2 = shape[ 7 ]; \ - S3 = shape[ 6 ]; \ - S4 = shape[ 5 ]; \ - S5 = shape[ 4 ]; \ - S6 = shape[ 3 ]; \ - S7 = shape[ 2 ]; \ - S8 = shape[ 1 ]; \ - S9 = shape[ 0 ]; \ - d0x1 = sx1[ 9 ]; \ - d1x1 = sx1[ 8 ] - ( S0*sx1[9] ); \ - d2x1 = sx1[ 7 ] - ( S1*sx1[8] ); \ - d3x1 = sx1[ 6 ] - ( S2*sx1[7] ); \ - d4x1 = sx1[ 5 ] - ( S3*sx1[6] ); \ - d5x1 = sx1[ 4 ] - ( S4*sx1[5] ); \ - d6x1 = sx1[ 3 ] - ( S5*sx1[4] ); \ - d7x1 = sx1[ 2 ] - ( S6*sx1[3] ); \ - d8x1 = sx1[ 1 ] - ( S7*sx1[2] ); \ - d9x1 = sx1[ 0 ] - ( S8*sx1[1] ); \ - d0x2 = sx2[ 9 ]; \ - d1x2 = sx2[ 8 ] - ( S0*sx2[9] ); \ - d2x2 = sx2[ 7 ] - ( S1*sx2[8] ); \ - d3x2 = sx2[ 6 ] - ( S2*sx2[7] ); \ - d4x2 = sx2[ 5 ] - ( S3*sx2[6] ); \ - d5x2 = sx2[ 4 ] - ( S4*sx2[5] ); \ - d6x2 = sx2[ 3 ] - ( S5*sx2[4] ); \ - d7x2 = sx2[ 2 ] - ( S6*sx2[3] ); \ - d8x2 = sx2[ 1 ] - ( S7*sx2[2] ); \ - d9x2 = sx2[ 0 ] - ( S8*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - S7 = shape[ 7 ]; \ - S8 = shape[ 8 ]; \ - S9 = shape[ 9 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d7x1 = sx1[ 7 ] - ( S6*sx1[6] ); \ - d8x1 = sx1[ 8 ] - ( S7*sx1[7] ); \ - d9x1 = sx1[ 9 ] - ( S8*sx1[8] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d7x2 = sx2[ 7 ] - ( S6*sx2[6] ); \ - d8x2 = sx2[ 8 ] - ( S7*sx2[7] ); \ - d9x2 = sx2[ 9 ] - ( S8*sx2[8] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i9 = 0; i9 < S9; i9++, px1 += d9x1, px2 += d9x2 ) { \ - for ( i8 = 0; i8 < S8; i8++, px1 += d8x1, px2 += d8x2 ) { \ - for ( i7 = 0; i7 < S7; i7++, px1 += d7x1, px2 += d7x2 ) { \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a ten-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_10D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d9x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t d9x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t d7x3; \ - int64_t d8x3; \ - int64_t d9x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t S7; \ - int64_t S8; \ - int64_t S9; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - int64_t i9; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 9 ]; \ - S1 = shape[ 8 ]; \ - S2 = shape[ 7 ]; \ - S3 = shape[ 6 ]; \ - S4 = shape[ 5 ]; \ - S5 = shape[ 4 ]; \ - S6 = shape[ 3 ]; \ - S7 = shape[ 2 ]; \ - S8 = shape[ 1 ]; \ - S9 = shape[ 0 ]; \ - d0x1 = sx1[ 9 ]; \ - d1x1 = sx1[ 8 ] - ( S0*sx1[9] ); \ - d2x1 = sx1[ 7 ] - ( S1*sx1[8] ); \ - d3x1 = sx1[ 6 ] - ( S2*sx1[7] ); \ - d4x1 = sx1[ 5 ] - ( S3*sx1[6] ); \ - d5x1 = sx1[ 4 ] - ( S4*sx1[5] ); \ - d6x1 = sx1[ 3 ] - ( S5*sx1[4] ); \ - d7x1 = sx1[ 2 ] - ( S6*sx1[3] ); \ - d8x1 = sx1[ 1 ] - ( S7*sx1[2] ); \ - d9x1 = sx1[ 0 ] - ( S8*sx1[1] ); \ - d0x2 = sx2[ 9 ]; \ - d1x2 = sx2[ 8 ] - ( S0*sx2[9] ); \ - d2x2 = sx2[ 7 ] - ( S1*sx2[8] ); \ - d3x2 = sx2[ 6 ] - ( S2*sx2[7] ); \ - d4x2 = sx2[ 5 ] - ( S3*sx2[6] ); \ - d5x2 = sx2[ 4 ] - ( S4*sx2[5] ); \ - d6x2 = sx2[ 3 ] - ( S5*sx2[4] ); \ - d7x2 = sx2[ 2 ] - ( S6*sx2[3] ); \ - d8x2 = sx2[ 1 ] - ( S7*sx2[2] ); \ - d9x2 = sx2[ 0 ] - ( S8*sx2[1] ); \ - d0x3 = sx3[ 9 ]; \ - d1x3 = sx3[ 8 ] - ( S0*sx3[9] ); \ - d2x3 = sx3[ 7 ] - ( S1*sx3[8] ); \ - d3x3 = sx3[ 6 ] - ( S2*sx3[7] ); \ - d4x3 = sx3[ 5 ] - ( S3*sx3[6] ); \ - d5x3 = sx3[ 4 ] - ( S4*sx3[5] ); \ - d6x3 = sx3[ 3 ] - ( S5*sx3[4] ); \ - d7x3 = sx3[ 2 ] - ( S6*sx3[3] ); \ - d8x3 = sx3[ 1 ] - ( S7*sx3[2] ); \ - d9x3 = sx3[ 0 ] - ( S8*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - S7 = shape[ 7 ]; \ - S8 = shape[ 8 ]; \ - S9 = shape[ 9 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d7x1 = sx1[ 7 ] - ( S6*sx1[6] ); \ - d8x1 = sx1[ 8 ] - ( S7*sx1[7] ); \ - d9x1 = sx1[ 9 ] - ( S8*sx1[8] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d7x2 = sx2[ 7 ] - ( S6*sx2[6] ); \ - d8x2 = sx2[ 8 ] - ( S7*sx2[7] ); \ - d9x2 = sx2[ 9 ] - ( S8*sx2[8] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[3] ); \ - d5x3 = sx3[ 5 ] - ( S4*sx3[4] ); \ - d6x3 = sx3[ 6 ] - ( S5*sx3[5] ); \ - d7x3 = sx3[ 7 ] - ( S6*sx3[6] ); \ - d8x3 = sx3[ 8 ] - ( S7*sx3[7] ); \ - d9x3 = sx3[ 9 ] - ( S8*sx3[8] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i9 = 0; i9 < S9; i9++, px1 += d9x1, px2 += d9x2, px3 += d9x3 ) { \ - for ( i8 = 0; i8 < S8; i8++, px1 += d8x1, px2 += d8x2, px3 += d8x3 ) { \ - for ( i7 = 0; i7 < S7; i7++, px1 += d7x1, px2 += d7x2, px3 += d7x3 ) { \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a ten-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_10D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a unary ten-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_10D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE - -/** -* Macro for a unary ten-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE - -/** -* Macro for a unary ten-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE - -/** -* Macro for a unary ten-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE - -/** -* Macro for a unary ten-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE - -/** -* Macro for a unary ten-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_10D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_10D_H diff --git a/include/stdlib/ndarray/base/unary/macros/10d_blocked.h b/include/stdlib/ndarray/base/unary/macros/10d_blocked.h deleted file mode 100644 index 0d2631d..0000000 --- a/include/stdlib/ndarray/base/unary/macros/10d_blocked.h +++ /dev/null @@ -1,792 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_10D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_10D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a ten-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[10]; \ - int64_t sx1[10]; \ - int64_t sx2[10]; \ - int64_t idx[10]; \ - int64_t tmp[10]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d9x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t d9x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o7x1; \ - int64_t o8x1; \ - int64_t o9x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o7x2; \ - int64_t o8x2; \ - int64_t o9x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t s7; \ - int64_t s8; \ - int64_t s9; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - int64_t i9; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - int64_t j7; \ - int64_t j8; \ - int64_t j9; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 10, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 10, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 10, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 10, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j9 = shape[9]; j9 > 0; ) { \ - if ( j9 < bsize ) { \ - s9 = j9; \ - j9 = 0; \ - } else { \ - s9 = bsize; \ - j9 -= bsize; \ - } \ - o9x1 = ox1 + ( j9*sx1[9] ); \ - o9x2 = ox2 + ( j9*sx2[9] ); \ - for ( j8 = shape[8]; j8 > 0; ) { \ - if ( j8 < bsize ) { \ - s8 = j8; \ - j8 = 0; \ - } else { \ - s8 = bsize; \ - j8 -= bsize; \ - } \ - d9x1 = sx1[9] - ( s8*sx1[8] ); \ - d9x2 = sx2[9] - ( s8*sx2[8] ); \ - o8x1 = o9x1 + ( j8*sx1[8] ); \ - o8x2 = o9x2 + ( j8*sx2[8] ); \ - for ( j7 = shape[7]; j7 > 0; ) { \ - if ( j7 < bsize ) { \ - s7 = j7; \ - j7 = 0; \ - } else { \ - s7 = bsize; \ - j7 -= bsize; \ - } \ - d8x1 = sx1[8] - ( s7*sx1[7] ); \ - d8x2 = sx2[8] - ( s7*sx2[7] ); \ - o7x1 = o8x1 + ( j7*sx1[7] ); \ - o7x2 = o8x2 + ( j7*sx2[7] ); \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - d7x1 = sx1[7] - ( s6*sx1[6] ); \ - d7x2 = sx2[7] - ( s6*sx2[6] ); \ - o6x1 = o7x1 + ( j6*sx1[6] ); \ - o6x2 = o7x2 + ( j6*sx2[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i9 = 0; i9 < s9; i9++, px1 += d9x1, px2 += d9x2 ) { \ - for ( i8 = 0; i8 < s8; i8++, px1 += d8x1, px2 += d8x2 ) { \ - for ( i7 = 0; i7 < s7; i7++, px1 += d7x1, px2 += d7x2 ) { \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a ten-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[10]; \ - int64_t sx1[10]; \ - int64_t sx2[10]; \ - int64_t sx3[10]; \ - int64_t idx[10]; \ - int64_t tmp[10]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d9x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t d9x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t d7x3; \ - int64_t d8x3; \ - int64_t d9x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o7x1; \ - int64_t o8x1; \ - int64_t o9x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o7x2; \ - int64_t o8x2; \ - int64_t o9x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t o4x3; \ - int64_t o5x3; \ - int64_t o6x3; \ - int64_t o7x3; \ - int64_t o8x3; \ - int64_t o9x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t s7; \ - int64_t s8; \ - int64_t s9; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - int64_t i9; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - int64_t j7; \ - int64_t j8; \ - int64_t j9; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 10, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 10, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 10, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 10, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 10, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j9 = shape[9]; j9 > 0; ) { \ - if ( j9 < bsize ) { \ - s9 = j9; \ - j9 = 0; \ - } else { \ - s9 = bsize; \ - j9 -= bsize; \ - } \ - o9x1 = ox1 + ( j9*sx1[9] ); \ - o9x2 = ox2 + ( j9*sx2[9] ); \ - o9x3 = ox3 + ( j9*sx3[9] ); \ - for ( j8 = shape[8]; j8 > 0; ) { \ - if ( j8 < bsize ) { \ - s8 = j8; \ - j8 = 0; \ - } else { \ - s8 = bsize; \ - j8 -= bsize; \ - } \ - d9x1 = sx1[9] - ( s8*sx1[8] ); \ - d9x2 = sx2[9] - ( s8*sx2[8] ); \ - d9x3 = sx3[9] - ( s8*sx3[8] ); \ - o8x1 = o9x1 + ( j8*sx1[8] ); \ - o8x2 = o9x2 + ( j8*sx2[8] ); \ - o8x3 = o9x3 + ( j8*sx3[8] ); \ - for ( j7 = shape[7]; j7 > 0; ) { \ - if ( j7 < bsize ) { \ - s7 = j7; \ - j7 = 0; \ - } else { \ - s7 = bsize; \ - j7 -= bsize; \ - } \ - d8x1 = sx1[8] - ( s7*sx1[7] ); \ - d8x2 = sx2[8] - ( s7*sx2[7] ); \ - d8x3 = sx3[8] - ( s7*sx3[7] ); \ - o7x1 = o8x1 + ( j7*sx1[7] ); \ - o7x2 = o8x2 + ( j7*sx2[7] ); \ - o7x3 = o8x3 + ( j7*sx3[7] ); \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - d7x1 = sx1[7] - ( s6*sx1[6] ); \ - d7x2 = sx2[7] - ( s6*sx2[6] ); \ - d7x3 = sx3[7] - ( s6*sx3[6] ); \ - o6x1 = o7x1 + ( j6*sx1[6] ); \ - o6x2 = o7x2 + ( j6*sx2[6] ); \ - o6x3 = o7x3 + ( j6*sx3[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - d6x3 = sx3[6] - ( s5*sx3[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - o5x3 = o6x3 + ( j5*sx3[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - d5x3 = sx3[5] - ( s4*sx3[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - o4x3 = o5x3 + ( j4*sx3[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - d4x3 = sx3[4] - ( s3*sx3[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - o3x3 = o4x3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i9 = 0; i9 < s9; i9++, px1 += d9x1, px2 += d9x2, px3 += d9x3 ) { \ - for ( i8 = 0; i8 < s8; i8++, px1 += d8x1, px2 += d8x2, px3 += d8x3 ) { \ - for ( i7 = 0; i7 < s7; i7++, px1 += d7x1, px2 += d7x2, px3 += d7x3 ) { \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a ten-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary ten-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary ten-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary ten-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary ten-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary ten-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary ten-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_10D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/1d.h b/include/stdlib/ndarray/base/unary/macros/1d.h deleted file mode 100644 index 6fb0cf4..0000000 --- a/include/stdlib/ndarray/base/unary/macros/1d.h +++ /dev/null @@ -1,303 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_1D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_1D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Macro containing the preamble for a loop which operates on elements of a one-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_1D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d0x2; \ - int64_t S0; \ - int64_t i0; \ - /* Extract loop variables: dimensions and loop offset (pointer) increments... */ \ - S0 = shape[ 0 ]; \ - d0x1 = sx1[ 0 ]; \ - d0x2 = sx2[ 0 ]; \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for a loop which operates on elements of a one-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_1D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d0x2; \ - int64_t d0x3; \ - int64_t S0; \ - int64_t i0; \ - /* Extract loop variable: dimensions and loop offset (pointer) increments... */ \ - S0 = shape[ 0 ]; \ - d0x1 = sx1[ 0 ]; \ - d0x2 = sx2[ 0 ]; \ - d0x3 = sx3[ 0 ]; \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for loops which operate on elements of a one-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_1D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for a unary one-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_1D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for a unary one-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for a unary one-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for a unary one-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for a unary one-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for a unary one-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_1D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_1D_LOOP_EPILOGUE - -/** -* Macro for operating on elements of a one-dimensional ndarray using a unary strided array function. -* -* @param strided_array_fcn strided array function - -* @example -* #include "stdlib/strided/base/unary.h" -* -* STDLIB_NDARRAY_UNARY_1D_VIA_STRIDED( stdlib_strided_b_b ) -*/ -#define STDLIB_NDARRAY_UNARY_1D_VIA_STRIDED( strided_array_fcn ) \ - struct ndarray *x1 = arrays[ 0 ]; \ - struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[] = { \ - stdlib_ndarray_dimension( x1, 0 ) \ - }; \ - int64_t strides[] = { \ - stdlib_ndarray_stride( x1, 0 ), \ - stdlib_ndarray_stride( x2, 0 ) \ - }; \ - /* Set pointers to the first indexed element in the ndarray view: */ \ - uint8_t *strided_arrays[] = { \ - stdlib_ndarray_data( x1 ) + stdlib_ndarray_offset( x1 ), \ - stdlib_ndarray_data( x2 ) + stdlib_ndarray_offset( x2 ) \ - }; \ - /* For negative strides, we need to adjust the pointers to the last indexed element, as strided implementations expect data pointers to point to where the data buffer begins in memory... */ \ - if ( strides[ 0 ] < 0 ) { \ - strided_arrays[ 0 ] += strides[ 0 ] * shape[ 0 ]; \ - } \ - if ( strides[ 1 ] < 0 ) { \ - strided_arrays[ 1 ] += strides[ 1 ] * shape[ 0 ]; \ - } \ - strided_array_fcn( strided_arrays, shape, strides, fcn ); - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_1D_H diff --git a/include/stdlib/ndarray/base/unary/macros/2d.h b/include/stdlib/ndarray/base/unary/macros/2d.h deleted file mode 100644 index 7c9b6b2..0000000 --- a/include/stdlib/ndarray/base/unary/macros/2d.h +++ /dev/null @@ -1,313 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_2D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_2D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a two-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_2D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t i0; \ - int64_t i1; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 1 ]; \ - S1 = shape[ 0 ]; \ - d0x1 = sx1[ 1 ]; \ - d1x1 = sx1[ 0 ] - ( S0*sx1[1] ); \ - d0x2 = sx2[ 1 ]; \ - d1x2 = sx2[ 0 ] - ( S0*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a two-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_2D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t i0; \ - int64_t i1; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 1 ]; \ - S1 = shape[ 0 ]; \ - d0x1 = sx1[ 1 ]; \ - d1x1 = sx1[ 0 ] - ( S0*sx1[1] ); \ - d0x2 = sx2[ 1 ]; \ - d1x2 = sx2[ 0 ] - ( S0*sx2[1] ); \ - d0x3 = sx3[ 1 ]; \ - d1x3 = sx3[ 0 ] - ( S0*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a two-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_2D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE \ - } - -/** -* Macro for a unary two-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_2D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE - -/** -* Macro for a unary two-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE - -/** -* Macro for a unary two-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE - -/** -* Macro for a unary two-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE - -/** -* Macro for a unary two-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE - -/** -* Macro for a unary two-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_2D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_2D_H diff --git a/include/stdlib/ndarray/base/unary/macros/2d_blocked.h b/include/stdlib/ndarray/base/unary/macros/2d_blocked.h deleted file mode 100644 index 09eeeca..0000000 --- a/include/stdlib/ndarray/base/unary/macros/2d_blocked.h +++ /dev/null @@ -1,424 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_2D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_2D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a two-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[2]; \ - int64_t sx1[2]; \ - int64_t sx2[2]; \ - int64_t idx[2]; \ - int64_t tmp[2]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t o1x1; \ - int64_t o1x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t i0; \ - int64_t i1; \ - int64_t j0; \ - int64_t j1; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 2, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 2, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 2, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 2, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - o1x1 = ox1 + ( j1*sx1[1] ); \ - o1x2 = ox2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a two-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[2]; \ - int64_t sx1[2]; \ - int64_t sx2[2]; \ - int64_t sx3[2]; \ - int64_t idx[2]; \ - int64_t tmp[2]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t o1x1; \ - int64_t o1x2; \ - int64_t o1x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t i0; \ - int64_t i1; \ - int64_t j0; \ - int64_t j1; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 2, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 2, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 2, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 2, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 2, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - o1x1 = ox1 + ( j1*sx1[1] ); \ - o1x2 = ox2 + ( j1*sx2[1] ); \ - o1x3 = ox3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a two-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } - -/** -* Macro for a blocked unary two-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary two-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary two-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary two-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary two-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary two-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_2D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/3d.h b/include/stdlib/ndarray/base/unary/macros/3d.h deleted file mode 100644 index 414abd9..0000000 --- a/include/stdlib/ndarray/base/unary/macros/3d.h +++ /dev/null @@ -1,339 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_3D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_3D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a three-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_3D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 2 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 0 ]; \ - d0x1 = sx1[ 2 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[2] ); \ - d2x1 = sx1[ 0 ] - ( S1*sx1[1] ); \ - d0x2 = sx2[ 2 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[2] ); \ - d2x2 = sx2[ 0 ] - ( S1*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a three-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_3D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 2 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 0 ]; \ - d0x1 = sx1[ 2 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[2] ); \ - d2x1 = sx1[ 0 ] - ( S1*sx1[1] ); \ - d0x2 = sx2[ 2 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[2] ); \ - d2x2 = sx2[ 0 ] - ( S1*sx2[1] ); \ - d0x3 = sx3[ 2 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[2] ); \ - d2x3 = sx3[ 0 ] - ( S1*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a three-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_3D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE \ - } \ - } - -/** -* Macro for a unary three-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_3D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE - -/** -* Macro for a unary three-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE - -/** -* Macro for a unary three-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE - -/** -* Macro for a unary three-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE - -/** -* Macro for a unary three-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE - -/** -* Macro for a unary three-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_3D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_3D_H diff --git a/include/stdlib/ndarray/base/unary/macros/3d_blocked.h b/include/stdlib/ndarray/base/unary/macros/3d_blocked.h deleted file mode 100644 index e616af1..0000000 --- a/include/stdlib/ndarray/base/unary/macros/3d_blocked.h +++ /dev/null @@ -1,470 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_3D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_3D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a three-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[3]; \ - int64_t sx1[3]; \ - int64_t sx2[3]; \ - int64_t idx[3]; \ - int64_t tmp[3]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 3, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 3, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 3, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 3, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - o2x1 = ox1 + ( j2*sx1[2] ); \ - o2x2 = ox2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a three-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[3]; \ - int64_t sx1[3]; \ - int64_t sx2[3]; \ - int64_t sx3[3]; \ - int64_t idx[3]; \ - int64_t tmp[3]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 3, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 3, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 3, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 3, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 3, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - o2x1 = ox1 + ( j2*sx1[2] ); \ - o2x2 = ox2 + ( j2*sx2[2] ); \ - o2x3 = ox3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a three-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary three-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary three-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary three-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary three-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary three-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary three-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_3D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/4d.h b/include/stdlib/ndarray/base/unary/macros/4d.h deleted file mode 100644 index 8d587ba..0000000 --- a/include/stdlib/ndarray/base/unary/macros/4d.h +++ /dev/null @@ -1,365 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_4D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_4D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a four-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_4D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 3 ]; \ - S1 = shape[ 2 ]; \ - S2 = shape[ 1 ]; \ - S3 = shape[ 0 ]; \ - d0x1 = sx1[ 3 ]; \ - d1x1 = sx1[ 2 ] - ( S0*sx1[3] ); \ - d2x1 = sx1[ 1 ] - ( S1*sx1[2] ); \ - d3x1 = sx1[ 0 ] - ( S2*sx1[1] ); \ - d0x2 = sx2[ 3 ]; \ - d1x2 = sx2[ 2 ] - ( S0*sx2[3] ); \ - d2x2 = sx2[ 1 ] - ( S1*sx2[2] ); \ - d3x2 = sx2[ 0 ] - ( S2*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a four-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_4D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 3 ]; \ - S1 = shape[ 2 ]; \ - S2 = shape[ 1 ]; \ - S3 = shape[ 0 ]; \ - d0x1 = sx1[ 3 ]; \ - d1x1 = sx1[ 2 ] - ( S0*sx1[3] ); \ - d2x1 = sx1[ 1 ] - ( S1*sx1[2] ); \ - d3x1 = sx1[ 0 ] - ( S2*sx1[1] ); \ - d0x2 = sx2[ 3 ]; \ - d1x2 = sx2[ 2 ] - ( S0*sx2[3] ); \ - d2x2 = sx2[ 1 ] - ( S1*sx2[2] ); \ - d3x2 = sx2[ 0 ] - ( S2*sx2[1] ); \ - d0x3 = sx3[ 3 ]; \ - d1x3 = sx3[ 2 ] - ( S0*sx3[3] ); \ - d2x3 = sx3[ 1 ] - ( S1*sx3[2] ); \ - d3x3 = sx3[ 0 ] - ( S2*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a four-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_4D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE \ - } \ - } \ - } - -/** -* Macro for a unary four-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_4D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE - -/** -* Macro for a unary four-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE - -/** -* Macro for a unary four-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE - -/** -* Macro for a unary four-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE - -/** -* Macro for a unary four-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE - -/** -* Macro for a unary four-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_4D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_4D_H diff --git a/include/stdlib/ndarray/base/unary/macros/4d_blocked.h b/include/stdlib/ndarray/base/unary/macros/4d_blocked.h deleted file mode 100644 index 179a00a..0000000 --- a/include/stdlib/ndarray/base/unary/macros/4d_blocked.h +++ /dev/null @@ -1,516 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_4D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_4D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a four-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[4]; \ - int64_t sx1[4]; \ - int64_t sx2[4]; \ - int64_t idx[4]; \ - int64_t tmp[4]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 4, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 4, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 4, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 4, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - o3x1 = ox1 + ( j3*sx1[3] ); \ - o3x2 = ox2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a four-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[4]; \ - int64_t sx1[4]; \ - int64_t sx2[4]; \ - int64_t sx3[4]; \ - int64_t idx[4]; \ - int64_t tmp[4]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 4, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 4, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 4, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 4, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 4, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - o3x1 = ox1 + ( j3*sx1[3] ); \ - o3x2 = ox2 + ( j3*sx2[3] ); \ - o3x3 = ox3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a four-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary four-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary four-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary four-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary four-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary four-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary four-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_4D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/5d.h b/include/stdlib/ndarray/base/unary/macros/5d.h deleted file mode 100644 index 849addb..0000000 --- a/include/stdlib/ndarray/base/unary/macros/5d.h +++ /dev/null @@ -1,391 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_5D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_5D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a five-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_5D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 4 ]; \ - S1 = shape[ 3 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 1 ]; \ - S4 = shape[ 0 ]; \ - d0x1 = sx1[ 4 ]; \ - d1x1 = sx1[ 3 ] - ( S0*sx1[4] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[3] ); \ - d3x1 = sx1[ 1 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 0 ] - ( S3*sx1[1] ); \ - d0x2 = sx2[ 4 ]; \ - d1x2 = sx2[ 3 ] - ( S0*sx2[4] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[3] ); \ - d3x2 = sx2[ 1 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 0 ] - ( S3*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a five-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_5D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 4 ]; \ - S1 = shape[ 3 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 1 ]; \ - S4 = shape[ 0 ]; \ - d0x1 = sx1[ 4 ]; \ - d1x1 = sx1[ 3 ] - ( S0*sx1[4] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[3] ); \ - d3x1 = sx1[ 1 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 0 ] - ( S3*sx1[1] ); \ - d0x2 = sx2[ 4 ]; \ - d1x2 = sx2[ 3 ] - ( S0*sx2[4] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[3] ); \ - d3x2 = sx2[ 1 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 0 ] - ( S3*sx2[1] ); \ - d0x3 = sx3[ 4 ]; \ - d1x3 = sx3[ 3 ] - ( S0*sx3[4] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[3] ); \ - d3x3 = sx3[ 1 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 0 ] - ( S3*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[3] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a five-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_5D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE \ - } \ - } \ - } \ - } - -/** -* Macro for a unary five-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_5D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE - -/** -* Macro for a unary five-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE - -/** -* Macro for a unary five-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE - -/** -* Macro for a unary five-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE - -/** -* Macro for a unary five-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE - -/** -* Macro for a unary five-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_5D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_5D_H diff --git a/include/stdlib/ndarray/base/unary/macros/5d_blocked.h b/include/stdlib/ndarray/base/unary/macros/5d_blocked.h deleted file mode 100644 index 6f40f7f..0000000 --- a/include/stdlib/ndarray/base/unary/macros/5d_blocked.h +++ /dev/null @@ -1,562 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_5D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_5D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a five-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[5]; \ - int64_t sx1[5]; \ - int64_t sx2[5]; \ - int64_t idx[5]; \ - int64_t tmp[5]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 5, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 5, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 5, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 5, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - o4x1 = ox1 + ( j4*sx1[4] ); \ - o4x2 = ox2 + ( j4*sx2[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a five-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[5]; \ - int64_t sx1[5]; \ - int64_t sx2[5]; \ - int64_t sx3[5]; \ - int64_t idx[5]; \ - int64_t tmp[5]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t o4x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 5, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 5, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 5, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 5, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 5, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - o4x1 = ox1 + ( j4*sx1[4] ); \ - o4x2 = ox2 + ( j4*sx2[4] ); \ - o4x3 = ox3 + ( j4*sx3[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - d4x3 = sx3[4] - ( s3*sx3[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - o3x3 = o4x3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a five-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary five-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary five-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary five-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary five-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary five-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary five-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_5D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/6d.h b/include/stdlib/ndarray/base/unary/macros/6d.h deleted file mode 100644 index f12f1c1..0000000 --- a/include/stdlib/ndarray/base/unary/macros/6d.h +++ /dev/null @@ -1,417 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_6D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_6D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a six-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_6D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 5 ]; \ - S1 = shape[ 4 ]; \ - S2 = shape[ 3 ]; \ - S3 = shape[ 2 ]; \ - S4 = shape[ 1 ]; \ - S5 = shape[ 0 ]; \ - d0x1 = sx1[ 5 ]; \ - d1x1 = sx1[ 4 ] - ( S0*sx1[5] ); \ - d2x1 = sx1[ 3 ] - ( S1*sx1[4] ); \ - d3x1 = sx1[ 2 ] - ( S2*sx1[3] ); \ - d4x1 = sx1[ 1 ] - ( S3*sx1[2] ); \ - d5x1 = sx1[ 0 ] - ( S4*sx1[1] ); \ - d0x2 = sx2[ 5 ]; \ - d1x2 = sx2[ 4 ] - ( S0*sx2[5] ); \ - d2x2 = sx2[ 3 ] - ( S1*sx2[4] ); \ - d3x2 = sx2[ 2 ] - ( S2*sx2[3] ); \ - d4x2 = sx2[ 1 ] - ( S3*sx2[2] ); \ - d5x2 = sx2[ 0 ] - ( S4*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a six-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_6D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 5 ]; \ - S1 = shape[ 4 ]; \ - S2 = shape[ 3 ]; \ - S3 = shape[ 2 ]; \ - S4 = shape[ 1 ]; \ - S5 = shape[ 0 ]; \ - d0x1 = sx1[ 5 ]; \ - d1x1 = sx1[ 4 ] - ( S0*sx1[5] ); \ - d2x1 = sx1[ 3 ] - ( S1*sx1[4] ); \ - d3x1 = sx1[ 2 ] - ( S2*sx1[3] ); \ - d4x1 = sx1[ 1 ] - ( S3*sx1[2] ); \ - d5x1 = sx1[ 0 ] - ( S4*sx1[1] ); \ - d0x2 = sx2[ 5 ]; \ - d1x2 = sx2[ 4 ] - ( S0*sx2[5] ); \ - d2x2 = sx2[ 3 ] - ( S1*sx2[4] ); \ - d3x2 = sx2[ 2 ] - ( S2*sx2[3] ); \ - d4x2 = sx2[ 1 ] - ( S3*sx2[2] ); \ - d5x2 = sx2[ 0 ] - ( S4*sx2[1] ); \ - d0x3 = sx3[ 5 ]; \ - d1x3 = sx3[ 4 ] - ( S0*sx3[5] ); \ - d2x3 = sx3[ 3 ] - ( S1*sx3[4] ); \ - d3x3 = sx3[ 2 ] - ( S2*sx3[3] ); \ - d4x3 = sx3[ 1 ] - ( S3*sx3[2] ); \ - d5x3 = sx3[ 0 ] - ( S4*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[3] ); \ - d5x3 = sx3[ 5 ] - ( S4*sx3[4] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a six-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_6D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a unary six-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_6D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE - -/** -* Macro for a unary six-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE - -/** -* Macro for a unary six-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE - -/** -* Macro for a unary six-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE - -/** -* Macro for a unary six-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE - -/** -* Macro for a unary six-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_6D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_6D_H diff --git a/include/stdlib/ndarray/base/unary/macros/6d_blocked.h b/include/stdlib/ndarray/base/unary/macros/6d_blocked.h deleted file mode 100644 index 1ebb6e0..0000000 --- a/include/stdlib/ndarray/base/unary/macros/6d_blocked.h +++ /dev/null @@ -1,608 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_6D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_6D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a six-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[6]; \ - int64_t sx1[6]; \ - int64_t sx2[6]; \ - int64_t idx[6]; \ - int64_t tmp[6]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 6, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 6, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 6, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 6, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - o5x1 = ox1 + ( j5*sx1[5] ); \ - o5x2 = ox2 + ( j5*sx2[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a six-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[6]; \ - int64_t sx1[6]; \ - int64_t sx2[6]; \ - int64_t sx3[6]; \ - int64_t idx[6]; \ - int64_t tmp[6]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t o4x3; \ - int64_t o5x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 6, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 6, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 6, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 6, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 6, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - o5x1 = ox1 + ( j5*sx1[5] ); \ - o5x2 = ox2 + ( j5*sx2[5] ); \ - o5x3 = ox3 + ( j5*sx3[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - d5x3 = sx3[5] - ( s4*sx3[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - o4x3 = o5x3 + ( j4*sx3[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - d4x3 = sx3[4] - ( s3*sx3[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - o3x3 = o4x3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a six-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary six-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary six-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary six-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary six-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary six-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary six-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_6D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/7d.h b/include/stdlib/ndarray/base/unary/macros/7d.h deleted file mode 100644 index 8447142..0000000 --- a/include/stdlib/ndarray/base/unary/macros/7d.h +++ /dev/null @@ -1,443 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_7D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_7D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a seven-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_7D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 6 ]; \ - S1 = shape[ 5 ]; \ - S2 = shape[ 4 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 2 ]; \ - S5 = shape[ 1 ]; \ - S6 = shape[ 0 ]; \ - d0x1 = sx1[ 6 ]; \ - d1x1 = sx1[ 5 ] - ( S0*sx1[6] ); \ - d2x1 = sx1[ 4 ] - ( S1*sx1[5] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[4] ); \ - d4x1 = sx1[ 2 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 1 ] - ( S4*sx1[2] ); \ - d6x1 = sx1[ 0 ] - ( S5*sx1[1] ); \ - d0x2 = sx2[ 6 ]; \ - d1x2 = sx2[ 5 ] - ( S0*sx2[6] ); \ - d2x2 = sx2[ 4 ] - ( S1*sx2[5] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[4] ); \ - d4x2 = sx2[ 2 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 1 ] - ( S4*sx2[2] ); \ - d6x2 = sx2[ 0 ] - ( S5*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a seven-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_7D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 6 ]; \ - S1 = shape[ 5 ]; \ - S2 = shape[ 4 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 2 ]; \ - S5 = shape[ 1 ]; \ - S6 = shape[ 0 ]; \ - d0x1 = sx1[ 6 ]; \ - d1x1 = sx1[ 5 ] - ( S0*sx1[6] ); \ - d2x1 = sx1[ 4 ] - ( S1*sx1[5] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[4] ); \ - d4x1 = sx1[ 2 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 1 ] - ( S4*sx1[2] ); \ - d6x1 = sx1[ 0 ] - ( S5*sx1[1] ); \ - d0x2 = sx2[ 6 ]; \ - d1x2 = sx2[ 5 ] - ( S0*sx2[6] ); \ - d2x2 = sx2[ 4 ] - ( S1*sx2[5] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[4] ); \ - d4x2 = sx2[ 2 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 1 ] - ( S4*sx2[2] ); \ - d6x2 = sx2[ 0 ] - ( S5*sx2[1] ); \ - d0x3 = sx3[ 6 ]; \ - d1x3 = sx3[ 5 ] - ( S0*sx3[6] ); \ - d2x3 = sx3[ 4 ] - ( S1*sx3[5] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[4] ); \ - d4x3 = sx3[ 2 ] - ( S3*sx3[3] ); \ - d5x3 = sx3[ 1 ] - ( S4*sx3[2] ); \ - d6x3 = sx3[ 0 ] - ( S5*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[3] ); \ - d5x3 = sx3[ 5 ] - ( S4*sx3[4] ); \ - d6x3 = sx3[ 6 ] - ( S5*sx3[5] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a seven-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_7D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a unary seven-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_7D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE - -/** -* Macro for a unary seven-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE - -/** -* Macro for a unary seven-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE - -/** -* Macro for a unary seven-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE - -/** -* Macro for a unary seven-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE - -/** -* Macro for a unary seven-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_7D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_7D_H diff --git a/include/stdlib/ndarray/base/unary/macros/7d_blocked.h b/include/stdlib/ndarray/base/unary/macros/7d_blocked.h deleted file mode 100644 index 1d54152..0000000 --- a/include/stdlib/ndarray/base/unary/macros/7d_blocked.h +++ /dev/null @@ -1,654 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_7D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_7D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a seven-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[7]; \ - int64_t sx1[7]; \ - int64_t sx2[7]; \ - int64_t idx[7]; \ - int64_t tmp[7]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 7, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 7, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 7, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 7, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - o6x1 = ox1 + ( j6*sx1[6] ); \ - o6x2 = ox2 + ( j6*sx2[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a seven-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[7]; \ - int64_t sx1[7]; \ - int64_t sx2[7]; \ - int64_t sx3[7]; \ - int64_t idx[7]; \ - int64_t tmp[7]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t o4x3; \ - int64_t o5x3; \ - int64_t o6x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 7, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 7, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 7, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 7, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 7, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - o6x1 = ox1 + ( j6*sx1[6] ); \ - o6x2 = ox2 + ( j6*sx2[6] ); \ - o6x3 = ox3 + ( j6*sx3[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - d6x3 = sx3[6] - ( s5*sx3[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - o5x3 = o6x3 + ( j5*sx3[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - d5x3 = sx3[5] - ( s4*sx3[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - o4x3 = o5x3 + ( j4*sx3[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - d4x3 = sx3[4] - ( s3*sx3[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - o3x3 = o4x3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a seven-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary seven-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary seven-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary seven-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary seven-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary seven-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary seven-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_7D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/8d.h b/include/stdlib/ndarray/base/unary/macros/8d.h deleted file mode 100644 index a89371e..0000000 --- a/include/stdlib/ndarray/base/unary/macros/8d.h +++ /dev/null @@ -1,469 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_8D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_8D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of an eight-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_8D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t S7; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 7 ]; \ - S1 = shape[ 6 ]; \ - S2 = shape[ 5 ]; \ - S3 = shape[ 4 ]; \ - S4 = shape[ 3 ]; \ - S5 = shape[ 2 ]; \ - S6 = shape[ 1 ]; \ - S7 = shape[ 0 ]; \ - d0x1 = sx1[ 7 ]; \ - d1x1 = sx1[ 6 ] - ( S0*sx1[7] ); \ - d2x1 = sx1[ 5 ] - ( S1*sx1[6] ); \ - d3x1 = sx1[ 4 ] - ( S2*sx1[5] ); \ - d4x1 = sx1[ 3 ] - ( S3*sx1[4] ); \ - d5x1 = sx1[ 2 ] - ( S4*sx1[3] ); \ - d6x1 = sx1[ 1 ] - ( S5*sx1[2] ); \ - d7x1 = sx1[ 0 ] - ( S6*sx1[1] ); \ - d0x2 = sx2[ 7 ]; \ - d1x2 = sx2[ 6 ] - ( S0*sx2[7] ); \ - d2x2 = sx2[ 5 ] - ( S1*sx2[6] ); \ - d3x2 = sx2[ 4 ] - ( S2*sx2[5] ); \ - d4x2 = sx2[ 3 ] - ( S3*sx2[4] ); \ - d5x2 = sx2[ 2 ] - ( S4*sx2[3] ); \ - d6x2 = sx2[ 1 ] - ( S5*sx2[2] ); \ - d7x2 = sx2[ 0 ] - ( S6*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - S7 = shape[ 7 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d7x1 = sx1[ 7 ] - ( S6*sx1[6] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d7x2 = sx2[ 7 ] - ( S6*sx2[6] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i7 = 0; i7 < S7; i7++, px1 += d7x1, px2 += d7x2 ) { \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of an eight-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_8D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t d7x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t S7; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 7 ]; \ - S1 = shape[ 6 ]; \ - S2 = shape[ 5 ]; \ - S3 = shape[ 4 ]; \ - S4 = shape[ 3 ]; \ - S5 = shape[ 2 ]; \ - S6 = shape[ 1 ]; \ - S7 = shape[ 0 ]; \ - d0x1 = sx1[ 7 ]; \ - d1x1 = sx1[ 6 ] - ( S0*sx1[7] ); \ - d2x1 = sx1[ 5 ] - ( S1*sx1[6] ); \ - d3x1 = sx1[ 4 ] - ( S2*sx1[5] ); \ - d4x1 = sx1[ 3 ] - ( S3*sx1[4] ); \ - d5x1 = sx1[ 2 ] - ( S4*sx1[3] ); \ - d6x1 = sx1[ 1 ] - ( S5*sx1[2] ); \ - d7x1 = sx1[ 0 ] - ( S6*sx1[1] ); \ - d0x2 = sx2[ 7 ]; \ - d1x2 = sx2[ 6 ] - ( S0*sx2[7] ); \ - d2x2 = sx2[ 5 ] - ( S1*sx2[6] ); \ - d3x2 = sx2[ 4 ] - ( S2*sx2[5] ); \ - d4x2 = sx2[ 3 ] - ( S3*sx2[4] ); \ - d5x2 = sx2[ 2 ] - ( S4*sx2[3] ); \ - d6x2 = sx2[ 1 ] - ( S5*sx2[2] ); \ - d7x2 = sx2[ 0 ] - ( S6*sx2[1] ); \ - d0x3 = sx3[ 7 ]; \ - d1x3 = sx3[ 6 ] - ( S0*sx3[7] ); \ - d2x3 = sx3[ 5 ] - ( S1*sx3[6] ); \ - d3x3 = sx3[ 4 ] - ( S2*sx3[5] ); \ - d4x3 = sx3[ 3 ] - ( S3*sx3[4] ); \ - d5x3 = sx3[ 2 ] - ( S4*sx3[3] ); \ - d6x3 = sx3[ 1 ] - ( S5*sx3[2] ); \ - d7x3 = sx3[ 0 ] - ( S6*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - S7 = shape[ 7 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d7x1 = sx1[ 7 ] - ( S6*sx1[6] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d7x2 = sx2[ 7 ] - ( S6*sx2[6] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[3] ); \ - d5x3 = sx3[ 5 ] - ( S4*sx3[4] ); \ - d6x3 = sx3[ 6 ] - ( S5*sx3[5] ); \ - d7x3 = sx3[ 7 ] - ( S6*sx3[6] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i7 = 0; i7 < S7; i7++, px1 += d7x1, px2 += d7x2, px3 += d7x3 ) { \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of an eight-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_8D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a unary eight-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_8D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE - -/** -* Macro for a unary eight-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE - -/** -* Macro for a unary eight-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE - -/** -* Macro for a unary eight-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE - -/** -* Macro for a unary eight-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE - -/** -* Macro for a unary eight-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_8D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_8D_H diff --git a/include/stdlib/ndarray/base/unary/macros/8d_blocked.h b/include/stdlib/ndarray/base/unary/macros/8d_blocked.h deleted file mode 100644 index fa3c352..0000000 --- a/include/stdlib/ndarray/base/unary/macros/8d_blocked.h +++ /dev/null @@ -1,700 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_8D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_8D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of an eight-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[8]; \ - int64_t sx1[8]; \ - int64_t sx2[8]; \ - int64_t idx[8]; \ - int64_t tmp[8]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o7x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o7x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t s7; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - int64_t j7; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 8, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 8, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 8, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 8, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j7 = shape[7]; j7 > 0; ) { \ - if ( j7 < bsize ) { \ - s7 = j7; \ - j7 = 0; \ - } else { \ - s7 = bsize; \ - j7 -= bsize; \ - } \ - o7x1 = ox1 + ( j7*sx1[7] ); \ - o7x2 = ox2 + ( j7*sx2[7] ); \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - d7x1 = sx1[7] - ( s6*sx1[6] ); \ - d7x2 = sx2[7] - ( s6*sx2[6] ); \ - o6x1 = o7x1 + ( j6*sx1[6] ); \ - o6x2 = o7x2 + ( j6*sx2[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i7 = 0; i7 < s7; i7++, px1 += d7x1, px2 += d7x2 ) { \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of an eight-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[8]; \ - int64_t sx1[8]; \ - int64_t sx2[8]; \ - int64_t sx3[8]; \ - int64_t idx[8]; \ - int64_t tmp[8]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t d7x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o7x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o7x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t o4x3; \ - int64_t o5x3; \ - int64_t o6x3; \ - int64_t o7x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t s7; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - int64_t j7; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 8, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 8, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 8, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 8, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 8, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j7 = shape[7]; j7 > 0; ) { \ - if ( j7 < bsize ) { \ - s7 = j7; \ - j7 = 0; \ - } else { \ - s7 = bsize; \ - j7 -= bsize; \ - } \ - o7x1 = ox1 + ( j7*sx1[7] ); \ - o7x2 = ox2 + ( j7*sx2[7] ); \ - o7x3 = ox3 + ( j7*sx3[7] ); \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - d7x1 = sx1[7] - ( s6*sx1[6] ); \ - d7x2 = sx2[7] - ( s6*sx2[6] ); \ - d7x3 = sx3[7] - ( s6*sx3[6] ); \ - o6x1 = o7x1 + ( j6*sx1[6] ); \ - o6x2 = o7x2 + ( j6*sx2[6] ); \ - o6x3 = o7x3 + ( j6*sx3[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - d6x3 = sx3[6] - ( s5*sx3[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - o5x3 = o6x3 + ( j5*sx3[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - d5x3 = sx3[5] - ( s4*sx3[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - o4x3 = o5x3 + ( j4*sx3[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - d4x3 = sx3[4] - ( s3*sx3[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - o3x3 = o4x3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i7 = 0; i7 < s7; i7++, px1 += d7x1, px2 += d7x2, px3 += d7x3 ) { \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of an eight-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary eight-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary eight-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary eight-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary eight-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary eight-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary eight-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_8D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/9d.h b/include/stdlib/ndarray/base/unary/macros/9d.h deleted file mode 100644 index 5a58a64..0000000 --- a/include/stdlib/ndarray/base/unary/macros/9d.h +++ /dev/null @@ -1,495 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_9D_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_9D_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of a nine-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_9D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t S7; \ - int64_t S8; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 8 ]; \ - S1 = shape[ 7 ]; \ - S2 = shape[ 6 ]; \ - S3 = shape[ 5 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 3 ]; \ - S6 = shape[ 2 ]; \ - S7 = shape[ 1 ]; \ - S8 = shape[ 0 ]; \ - d0x1 = sx1[ 8 ]; \ - d1x1 = sx1[ 7 ] - ( S0*sx1[8] ); \ - d2x1 = sx1[ 6 ] - ( S1*sx1[7] ); \ - d3x1 = sx1[ 5 ] - ( S2*sx1[6] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[5] ); \ - d5x1 = sx1[ 3 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 2 ] - ( S5*sx1[3] ); \ - d7x1 = sx1[ 1 ] - ( S6*sx1[2] ); \ - d8x1 = sx1[ 0 ] - ( S7*sx1[1] ); \ - d0x2 = sx2[ 8 ]; \ - d1x2 = sx2[ 7 ] - ( S0*sx2[8] ); \ - d2x2 = sx2[ 6 ] - ( S1*sx2[7] ); \ - d3x2 = sx2[ 5 ] - ( S2*sx2[6] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[5] ); \ - d5x2 = sx2[ 3 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 2 ] - ( S5*sx2[3] ); \ - d7x2 = sx2[ 1 ] - ( S6*sx2[2] ); \ - d8x2 = sx2[ 0 ] - ( S7*sx2[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - S7 = shape[ 7 ]; \ - S8 = shape[ 8 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d7x1 = sx1[ 7 ] - ( S6*sx1[6] ); \ - d8x1 = sx1[ 8 ] - ( S7*sx1[7] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d7x2 = sx2[ 7 ] - ( S6*sx2[6] ); \ - d8x2 = sx2[ 8 ] - ( S7*sx2[7] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i8 = 0; i8 < S8; i8++, px1 += d8x1, px2 += d8x2 ) { \ - for ( i7 = 0; i7 < S7; i7++, px1 += d7x1, px2 += d7x2 ) { \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for nested loops which operate on elements of a nine-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_9D_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - const int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - const int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - const int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - uint8_t *px1 = stdlib_ndarray_data( x1 ); \ - uint8_t *px2 = stdlib_ndarray_data( x2 ); \ - uint8_t *px3 = stdlib_ndarray_data( x3 ); \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t d7x3; \ - int64_t d8x3; \ - int64_t S0; \ - int64_t S1; \ - int64_t S2; \ - int64_t S3; \ - int64_t S4; \ - int64_t S5; \ - int64_t S6; \ - int64_t S7; \ - int64_t S8; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - /* Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... */ \ - if ( stdlib_ndarray_order( x1 ) == STDLIB_NDARRAY_ROW_MAJOR ) { \ - /* For row-major ndarrays, the last dimensions have the fastest changing indices... */ \ - S0 = shape[ 8 ]; \ - S1 = shape[ 7 ]; \ - S2 = shape[ 6 ]; \ - S3 = shape[ 5 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 3 ]; \ - S6 = shape[ 2 ]; \ - S7 = shape[ 1 ]; \ - S8 = shape[ 0 ]; \ - d0x1 = sx1[ 8 ]; \ - d1x1 = sx1[ 7 ] - ( S0*sx1[8] ); \ - d2x1 = sx1[ 6 ] - ( S1*sx1[7] ); \ - d3x1 = sx1[ 5 ] - ( S2*sx1[6] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[5] ); \ - d5x1 = sx1[ 3 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 2 ] - ( S5*sx1[3] ); \ - d7x1 = sx1[ 1 ] - ( S6*sx1[2] ); \ - d8x1 = sx1[ 0 ] - ( S7*sx1[1] ); \ - d0x2 = sx2[ 8 ]; \ - d1x2 = sx2[ 7 ] - ( S0*sx2[8] ); \ - d2x2 = sx2[ 6 ] - ( S1*sx2[7] ); \ - d3x2 = sx2[ 5 ] - ( S2*sx2[6] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[5] ); \ - d5x2 = sx2[ 3 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 2 ] - ( S5*sx2[3] ); \ - d7x2 = sx2[ 1 ] - ( S6*sx2[2] ); \ - d8x2 = sx2[ 0 ] - ( S7*sx2[1] ); \ - d0x3 = sx3[ 8 ]; \ - d1x3 = sx3[ 7 ] - ( S0*sx3[8] ); \ - d2x3 = sx3[ 6 ] - ( S1*sx3[7] ); \ - d3x3 = sx3[ 5 ] - ( S2*sx3[6] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[5] ); \ - d5x3 = sx3[ 3 ] - ( S4*sx3[4] ); \ - d6x3 = sx3[ 2 ] - ( S5*sx3[3] ); \ - d7x3 = sx3[ 1 ] - ( S6*sx3[2] ); \ - d8x3 = sx3[ 0 ] - ( S7*sx3[1] ); \ - } else { \ - /* For column-major ndarrays, the first dimensions have the fastest changing indices... */ \ - S0 = shape[ 0 ]; \ - S1 = shape[ 1 ]; \ - S2 = shape[ 2 ]; \ - S3 = shape[ 3 ]; \ - S4 = shape[ 4 ]; \ - S5 = shape[ 5 ]; \ - S6 = shape[ 6 ]; \ - S7 = shape[ 7 ]; \ - S8 = shape[ 8 ]; \ - d0x1 = sx1[ 0 ]; \ - d1x1 = sx1[ 1 ] - ( S0*sx1[0] ); \ - d2x1 = sx1[ 2 ] - ( S1*sx1[1] ); \ - d3x1 = sx1[ 3 ] - ( S2*sx1[2] ); \ - d4x1 = sx1[ 4 ] - ( S3*sx1[3] ); \ - d5x1 = sx1[ 5 ] - ( S4*sx1[4] ); \ - d6x1 = sx1[ 6 ] - ( S5*sx1[5] ); \ - d7x1 = sx1[ 7 ] - ( S6*sx1[6] ); \ - d8x1 = sx1[ 8 ] - ( S7*sx1[7] ); \ - d0x2 = sx2[ 0 ]; \ - d1x2 = sx2[ 1 ] - ( S0*sx2[0] ); \ - d2x2 = sx2[ 2 ] - ( S1*sx2[1] ); \ - d3x2 = sx2[ 3 ] - ( S2*sx2[2] ); \ - d4x2 = sx2[ 4 ] - ( S3*sx2[3] ); \ - d5x2 = sx2[ 5 ] - ( S4*sx2[4] ); \ - d6x2 = sx2[ 6 ] - ( S5*sx2[5] ); \ - d7x2 = sx2[ 7 ] - ( S6*sx2[6] ); \ - d8x2 = sx2[ 8 ] - ( S7*sx2[7] ); \ - d0x3 = sx3[ 0 ]; \ - d1x3 = sx3[ 1 ] - ( S0*sx3[0] ); \ - d2x3 = sx3[ 2 ] - ( S1*sx3[1] ); \ - d3x3 = sx3[ 3 ] - ( S2*sx3[2] ); \ - d4x3 = sx3[ 4 ] - ( S3*sx3[3] ); \ - d5x3 = sx3[ 5 ] - ( S4*sx3[4] ); \ - d6x3 = sx3[ 6 ] - ( S5*sx3[5] ); \ - d7x3 = sx3[ 7 ] - ( S6*sx3[6] ); \ - d8x3 = sx3[ 8 ] - ( S7*sx3[7] ); \ - } \ - /* Set the pointers to the first indexed elements... */ \ - px1 += stdlib_ndarray_offset( x1 ); \ - px2 += stdlib_ndarray_offset( x2 ); \ - px3 += stdlib_ndarray_offset( x3 ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i8 = 0; i8 < S8; i8++, px1 += d8x1, px2 += d8x2, px3 += d8x3 ) { \ - for ( i7 = 0; i7 < S7; i7++, px1 += d7x1, px2 += d7x2, px3 += d7x3 ) { \ - for ( i6 = 0; i6 < S6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < S5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < S4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < S3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < S2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < S1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < S0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for nested loops which operate on elements of a nine-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_9D_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a unary nine-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_9D_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE - -/** -* Macro for a unary nine-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE - -/** -* Macro for a unary nine-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE - -/** -* Macro for a unary nine-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE - -/** -* Macro for a unary nine-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE - -/** -* Macro for a unary nine-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_9D_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_9D_H diff --git a/include/stdlib/ndarray/base/unary/macros/9d_blocked.h b/include/stdlib/ndarray/base/unary/macros/9d_blocked.h deleted file mode 100644 index aea9013..0000000 --- a/include/stdlib/ndarray/base/unary/macros/9d_blocked.h +++ /dev/null @@ -1,746 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_9D_BLOCKED_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_9D_BLOCKED_H - -#include "stdlib/ndarray/base/unary/macros/constants.h" -#include "stdlib/ndarray/base/unary/internal/permute.h" -#include "stdlib/ndarray/base/unary/internal/range.h" -#include "stdlib/ndarray/base/unary/internal/sort2ins.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a nine-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - int64_t shape[9]; \ - int64_t sx1[9]; \ - int64_t sx2[9]; \ - int64_t idx[9]; \ - int64_t tmp[9]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o7x1; \ - int64_t o8x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o7x2; \ - int64_t o8x2; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t s7; \ - int64_t s8; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - int64_t j7; \ - int64_t j8; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 9, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 9, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 9, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 9, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - /* Cache offset increments for the innermost loop... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - /* Iterate over blocks... */ \ - for ( j8 = shape[8]; j8 > 0; ) { \ - if ( j8 < bsize ) { \ - s8 = j8; \ - j8 = 0; \ - } else { \ - s8 = bsize; \ - j8 -= bsize; \ - } \ - o8x1 = ox1 + ( j8*sx1[8] ); \ - o8x2 = ox2 + ( j8*sx2[8] ); \ - for ( j7 = shape[7]; j7 > 0; ) { \ - if ( j7 < bsize ) { \ - s7 = j7; \ - j7 = 0; \ - } else { \ - s7 = bsize; \ - j7 -= bsize; \ - } \ - d8x1 = sx1[8] - ( s7*sx1[7] ); \ - d8x2 = sx2[8] - ( s7*sx2[7] ); \ - o7x1 = o8x1 + ( j7*sx1[7] ); \ - o7x2 = o8x2 + ( j7*sx2[7] ); \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - d7x1 = sx1[7] - ( s6*sx1[6] ); \ - d7x2 = sx2[7] - ( s6*sx2[6] ); \ - o6x1 = o7x1 + ( j6*sx1[6] ); \ - o6x2 = o7x2 + ( j6*sx2[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i8 = 0; i8 < s8; i8++, px1 += d8x1, px2 += d8x2 ) { \ - for ( i7 = 0; i7 < s7; i7++, px1 += d7x1, px2 += d7x2 ) { \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2 ) - -/** -* Macro containing the preamble for blocked nested loops which operate on elements of a nine-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `pbx#`, `px#`, `ox#`, `nbx#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, `j@`, `o@x#`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - int64_t shape[9]; \ - int64_t sx1[9]; \ - int64_t sx2[9]; \ - int64_t sx3[9]; \ - int64_t idx[9]; \ - int64_t tmp[9]; \ - int64_t bsize; \ - uint8_t *pbx1; \ - uint8_t *pbx2; \ - uint8_t *pbx3; \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t d0x1; \ - int64_t d1x1; \ - int64_t d2x1; \ - int64_t d3x1; \ - int64_t d4x1; \ - int64_t d5x1; \ - int64_t d6x1; \ - int64_t d7x1; \ - int64_t d8x1; \ - int64_t d0x2; \ - int64_t d1x2; \ - int64_t d2x2; \ - int64_t d3x2; \ - int64_t d4x2; \ - int64_t d5x2; \ - int64_t d6x2; \ - int64_t d7x2; \ - int64_t d8x2; \ - int64_t d0x3; \ - int64_t d1x3; \ - int64_t d2x3; \ - int64_t d3x3; \ - int64_t d4x3; \ - int64_t d5x3; \ - int64_t d6x3; \ - int64_t d7x3; \ - int64_t d8x3; \ - int64_t o1x1; \ - int64_t o2x1; \ - int64_t o3x1; \ - int64_t o4x1; \ - int64_t o5x1; \ - int64_t o6x1; \ - int64_t o7x1; \ - int64_t o8x1; \ - int64_t o1x2; \ - int64_t o2x2; \ - int64_t o3x2; \ - int64_t o4x2; \ - int64_t o5x2; \ - int64_t o6x2; \ - int64_t o7x2; \ - int64_t o8x2; \ - int64_t o1x3; \ - int64_t o2x3; \ - int64_t o3x3; \ - int64_t o4x3; \ - int64_t o5x3; \ - int64_t o6x3; \ - int64_t o7x3; \ - int64_t o8x3; \ - int64_t nbx1; \ - int64_t nbx2; \ - int64_t nbx3; \ - int64_t ox1; \ - int64_t ox2; \ - int64_t ox3; \ - int64_t s0; \ - int64_t s1; \ - int64_t s2; \ - int64_t s3; \ - int64_t s4; \ - int64_t s5; \ - int64_t s6; \ - int64_t s7; \ - int64_t s8; \ - int64_t i0; \ - int64_t i1; \ - int64_t i2; \ - int64_t i3; \ - int64_t i4; \ - int64_t i5; \ - int64_t i6; \ - int64_t i7; \ - int64_t i8; \ - int64_t j0; \ - int64_t j1; \ - int64_t j2; \ - int64_t j3; \ - int64_t j4; \ - int64_t j5; \ - int64_t j6; \ - int64_t j7; \ - int64_t j8; \ - /* Copy strides to prevent mutation to the original ndarray: */ \ - memcpy( sx1, stdlib_ndarray_strides( x1 ), sizeof sx1 ); \ - /* Create a loop interchange index array for loop order permutation: */ \ - stdlib_ndarray_base_unary_internal_range( 9, idx ); \ - /* Sort the input array strides in increasing order (of magnitude): */ \ - stdlib_ndarray_base_unary_internal_sort2ins( 9, sx1, idx ); \ - /* Permute the shape and array strides (avoiding mutation) according to loop order: */ \ - stdlib_ndarray_base_unary_internal_permute( 9, stdlib_ndarray_shape( x1 ), idx, tmp ); \ - memcpy( shape, tmp, sizeof shape ); \ - stdlib_ndarray_base_unary_internal_permute( 9, stdlib_ndarray_strides( x2 ), idx, tmp ); \ - memcpy( sx2, tmp, sizeof sx2 ); \ - stdlib_ndarray_base_unary_internal_permute( 9, stdlib_ndarray_strides( x3 ), idx, tmp ); \ - memcpy( sx3, tmp, sizeof sx3 ); \ - /* Determine the block size... */ \ - nbx1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); \ - nbx2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); \ - nbx3 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x3 ) ); \ - if ( nbx1 == 0 && nbx2 == 0 && nbx3 == 0 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS; \ - } else if ( nbx1 > nbx2 && nbx1 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx1; \ - } else if ( nbx2 > nbx3 ) { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx2; \ - } else { \ - bsize = STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES / nbx3; \ - } \ - /* Cache pointers to the ndarray buffers... */ \ - pbx1 = stdlib_ndarray_data( x1 ); \ - pbx2 = stdlib_ndarray_data( x2 ); \ - pbx3 = stdlib_ndarray_data( x3 ); \ - /* Cache byte offsets to the first indexed elements... */ \ - ox1 = stdlib_ndarray_offset( x1 ); \ - ox2 = stdlib_ndarray_offset( x2 ); \ - ox3 = stdlib_ndarray_offset( x3 ); \ - /* Cache offset increments for the innermost loop ... */ \ - d0x1 = sx1[0]; \ - d0x2 = sx2[0]; \ - d0x3 = sx3[0]; \ - /* Iterate over blocks... */ \ - for ( j8 = shape[8]; j8 > 0; ) { \ - if ( j8 < bsize ) { \ - s8 = j8; \ - j8 = 0; \ - } else { \ - s8 = bsize; \ - j8 -= bsize; \ - } \ - o8x1 = ox1 + ( j8*sx1[8] ); \ - o8x2 = ox2 + ( j8*sx2[8] ); \ - o8x3 = ox3 + ( j8*sx3[8] ); \ - for ( j7 = shape[7]; j7 > 0; ) { \ - if ( j7 < bsize ) { \ - s7 = j7; \ - j7 = 0; \ - } else { \ - s7 = bsize; \ - j7 -= bsize; \ - } \ - d8x1 = sx1[8] - ( s7*sx1[7] ); \ - d8x2 = sx2[8] - ( s7*sx2[7] ); \ - d8x3 = sx3[8] - ( s7*sx3[7] ); \ - o7x1 = o8x1 + ( j7*sx1[7] ); \ - o7x2 = o8x2 + ( j7*sx2[7] ); \ - o7x3 = o8x3 + ( j7*sx3[7] ); \ - for ( j6 = shape[6]; j6 > 0; ) { \ - if ( j6 < bsize ) { \ - s6 = j6; \ - j6 = 0; \ - } else { \ - s6 = bsize; \ - j6 -= bsize; \ - } \ - d7x1 = sx1[7] - ( s6*sx1[6] ); \ - d7x2 = sx2[7] - ( s6*sx2[6] ); \ - d7x3 = sx3[7] - ( s6*sx3[6] ); \ - o6x1 = o7x1 + ( j6*sx1[6] ); \ - o6x2 = o7x2 + ( j6*sx2[6] ); \ - o6x3 = o7x3 + ( j6*sx3[6] ); \ - for ( j5 = shape[5]; j5 > 0; ) { \ - if ( j5 < bsize ) { \ - s5 = j5; \ - j5 = 0; \ - } else { \ - s5 = bsize; \ - j5 -= bsize; \ - } \ - d6x1 = sx1[6] - ( s5*sx1[5] ); \ - d6x2 = sx2[6] - ( s5*sx2[5] ); \ - d6x3 = sx3[6] - ( s5*sx3[5] ); \ - o5x1 = o6x1 + ( j5*sx1[5] ); \ - o5x2 = o6x2 + ( j5*sx2[5] ); \ - o5x3 = o6x3 + ( j5*sx3[5] ); \ - for ( j4 = shape[4]; j4 > 0; ) { \ - if ( j4 < bsize ) { \ - s4 = j4; \ - j4 = 0; \ - } else { \ - s4 = bsize; \ - j4 -= bsize; \ - } \ - d5x1 = sx1[5] - ( s4*sx1[4] ); \ - d5x2 = sx2[5] - ( s4*sx2[4] ); \ - d5x3 = sx3[5] - ( s4*sx3[4] ); \ - o4x1 = o5x1 + ( j4*sx1[4] ); \ - o4x2 = o5x2 + ( j4*sx2[4] ); \ - o4x3 = o5x3 + ( j4*sx3[4] ); \ - for ( j3 = shape[3]; j3 > 0; ) { \ - if ( j3 < bsize ) { \ - s3 = j3; \ - j3 = 0; \ - } else { \ - s3 = bsize; \ - j3 -= bsize; \ - } \ - d4x1 = sx1[4] - ( s3*sx1[3] ); \ - d4x2 = sx2[4] - ( s3*sx2[3] ); \ - d4x3 = sx3[4] - ( s3*sx3[3] ); \ - o3x1 = o4x1 + ( j3*sx1[3] ); \ - o3x2 = o4x2 + ( j3*sx2[3] ); \ - o3x3 = o4x3 + ( j3*sx3[3] ); \ - for ( j2 = shape[2]; j2 > 0; ) { \ - if ( j2 < bsize ) { \ - s2 = j2; \ - j2 = 0; \ - } else { \ - s2 = bsize; \ - j2 -= bsize; \ - } \ - d3x1 = sx1[3] - ( s2*sx1[2] ); \ - d3x2 = sx2[3] - ( s2*sx2[2] ); \ - d3x3 = sx3[3] - ( s2*sx3[2] ); \ - o2x1 = o3x1 + ( j2*sx1[2] ); \ - o2x2 = o3x2 + ( j2*sx2[2] ); \ - o2x3 = o3x3 + ( j2*sx3[2] ); \ - for ( j1 = shape[1]; j1 > 0; ) { \ - if ( j1 < bsize ) { \ - s1 = j1; \ - j1 = 0; \ - } else { \ - s1 = bsize; \ - j1 -= bsize; \ - } \ - d2x1 = sx1[2] - ( s1*sx1[1] ); \ - d2x2 = sx2[2] - ( s1*sx2[1] ); \ - d2x3 = sx3[2] - ( s1*sx3[1] ); \ - o1x1 = o2x1 + ( j1*sx1[1] ); \ - o1x2 = o2x2 + ( j1*sx2[1] ); \ - o1x3 = o2x3 + ( j1*sx3[1] ); \ - for ( j0 = shape[0]; j0 > 0; ) { \ - if ( j0 < bsize ) { \ - s0 = j0; \ - j0 = 0; \ - } else { \ - s0 = bsize; \ - j0 -= bsize; \ - } \ - /* Compute pointers to the first ndarray elements in the current block... */ \ - px1 = pbx1 + o1x1 + ( j0*sx1[0] ); \ - px2 = pbx2 + o1x2 + ( j0*sx2[0] ); \ - px3 = pbx3 + o1x3 + ( j0*sx3[0] ); \ - /* Compute loop offset increments... */ \ - d1x1 = sx1[1] - ( s0*sx1[0] ); \ - d1x2 = sx2[1] - ( s0*sx2[0] ); \ - d1x3 = sx3[1] - ( s0*sx3[0] ); \ - /* Iterate over the ndarray dimensions... */ \ - for ( i8 = 0; i8 < s8; i8++, px1 += d8x1, px2 += d8x2, px3 += d8x3 ) { \ - for ( i7 = 0; i7 < s7; i7++, px1 += d7x1, px2 += d7x2, px3 += d7x3 ) { \ - for ( i6 = 0; i6 < s6; i6++, px1 += d6x1, px2 += d6x2, px3 += d6x3 ) { \ - for ( i5 = 0; i5 < s5; i5++, px1 += d5x1, px2 += d5x2, px3 += d5x3 ) { \ - for ( i4 = 0; i4 < s4; i4++, px1 += d4x1, px2 += d4x2, px3 += d4x3 ) { \ - for ( i3 = 0; i3 < s3; i3++, px1 += d3x1, px2 += d3x2, px3 += d3x3 ) { \ - for ( i2 = 0; i2 < s2; i2++, px1 += d2x1, px2 += d2x2, px3 += d2x3 ) { \ - for ( i1 = 0; i1 < s1; i1++, px1 += d1x1, px2 += d1x2, px3 += d1x3 ) { \ - for ( i0 = 0; i0 < s0; i0++, px1 += d0x1, px2 += d0x2, px3 += d0x3 ) - -/** -* Macro containing the epilogue for blocked nested loops which operate on elements of a nine-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } \ - } - -/** -* Macro for a blocked unary nine-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary nine-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* // e.g., d_d -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary nine-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary nine-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary nine-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE - -/** -* Macro for a blocked unary nine-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_9D_BLOCKED_H diff --git a/include/stdlib/ndarray/base/unary/macros/constants.h b/include/stdlib/ndarray/base/unary/macros/constants.h deleted file mode 100644 index 7312bc7..0000000 --- a/include/stdlib/ndarray/base/unary/macros/constants.h +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_CONSTANTS_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_CONSTANTS_H - -// Define a default block size in units of bytes (Note: 64b is a common cache line size. How applicable the common cache line size is here is debatable, given that, depending on the associated stride(s), the innermost loop may not iterate over adjacent elements. The primary goal is to have a block size in which all data within a block can always fit in (L1) cache, regardless of cache size (i.e., cache-oblivious). For reference, a common L1 cache size is 32kB per core. For best performance, block sizes should be tuned based on system hardware; however, such tuning is not readily available to us here. Without obvious better alternatives, 64b has some theoretical (and practical) underpinning, and it should be good enough for most inputs, especially for ndarrays with near contiguity.): -#define STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_BYTES 64 - -// Define a default block size in units of elements (Note: 64 bytes / 8 bytes per element; i.e., default element size is same as a double): -#define STDLIB_NDARRAY_UNARY_BLOCK_SIZE_IN_ELEMENTS 8 - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_CONSTANTS_H diff --git a/include/stdlib/ndarray/base/unary/macros/nd.h b/include/stdlib/ndarray/base/unary/macros/nd.h deleted file mode 100644 index 64a00b9..0000000 --- a/include/stdlib/ndarray/base/unary/macros/nd.h +++ /dev/null @@ -1,282 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_MACROS_ND_H -#define STDLIB_NDARRAY_BASE_UNARY_MACROS_ND_H - -#include "stdlib/ndarray/ctor.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/base/vind2bind.h" -#include - -/** -* Macro containing the preamble for nested loops which operate on elements of an n-dimensional ndarray. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_ND_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - enum STDLIB_NDARRAY_INDEX_MODE mx1 = stdlib_ndarray_index_mode( x1 ); \ - enum STDLIB_NDARRAY_INDEX_MODE mx2 = stdlib_ndarray_index_mode( x2 ); \ - enum STDLIB_NDARRAY_ORDER ordx1 = stdlib_ndarray_order( x1 ); \ - enum STDLIB_NDARRAY_ORDER ordx2 = stdlib_ndarray_order( x2 ); \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - uint8_t *pbx1 = stdlib_ndarray_data( x1 ); \ - uint8_t *pbx2 = stdlib_ndarray_data( x2 ); \ - int64_t ndims = stdlib_ndarray_ndims( x1 ); \ - int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - int64_t ox1 = stdlib_ndarray_offset( x1 ); \ - int64_t ox2 = stdlib_ndarray_offset( x2 ); \ - int64_t len = stdlib_ndarray_length( x1 ); \ - uint8_t *px1; \ - uint8_t *px2; \ - int64_t i; \ - /* Iterate over each ndarray element based on the linear **view** index, regardless as to how the data is stored in memory... */ \ - for ( i = 0; i < len; i++ ) { \ - px1 = pbx1 + stdlib_ndarray_vind2bind( ndims, shape, sx1, ox1, ordx1, i, mx1 ); \ - px2 = pbx2 + stdlib_ndarray_vind2bind( ndims, shape, sx2, ox2, ordx2, i, mx2 ); \ - do - -/** -* Macro containing the preamble for nested loops which operate on elements of an n-dimensional input ndarray and updates two output ndarrays. -* -* ## Notes -* -* - Variable naming conventions: -* -* - `sx#`, `px#`, and `d@x#` where `#` corresponds to the ndarray argument number, starting at `1`. -* - `S@`, `i@`, and `d@x#` where `@` corresponds to the loop number, with `0` being the innermost loop. -* -* @example -* STDLIB_NDARRAY_UNARY_ND_LOOP_TWO_OUT_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_TWO_OUT_PREAMBLE \ - const struct ndarray *x1 = arrays[ 0 ]; \ - const struct ndarray *x2 = arrays[ 1 ]; \ - const struct ndarray *x3 = arrays[ 2 ]; \ - enum STDLIB_NDARRAY_INDEX_MODE mx1 = stdlib_ndarray_index_mode( x1 ); \ - enum STDLIB_NDARRAY_INDEX_MODE mx2 = stdlib_ndarray_index_mode( x2 ); \ - enum STDLIB_NDARRAY_INDEX_MODE mx3 = stdlib_ndarray_index_mode( x3 ); \ - enum STDLIB_NDARRAY_ORDER ordx1 = stdlib_ndarray_order( x1 ); \ - enum STDLIB_NDARRAY_ORDER ordx2 = stdlib_ndarray_order( x2 ); \ - enum STDLIB_NDARRAY_ORDER ordx3 = stdlib_ndarray_order( x3 ); \ - const int64_t *shape = stdlib_ndarray_shape( x1 ); \ - uint8_t *pbx1 = stdlib_ndarray_data( x1 ); \ - uint8_t *pbx2 = stdlib_ndarray_data( x2 ); \ - uint8_t *pbx3 = stdlib_ndarray_data( x3 ); \ - int64_t ndims = stdlib_ndarray_ndims( x1 ); \ - int64_t *sx1 = stdlib_ndarray_strides( x1 ); \ - int64_t *sx2 = stdlib_ndarray_strides( x2 ); \ - int64_t *sx3 = stdlib_ndarray_strides( x3 ); \ - int64_t ox1 = stdlib_ndarray_offset( x1 ); \ - int64_t ox2 = stdlib_ndarray_offset( x2 ); \ - int64_t ox3 = stdlib_ndarray_offset( x3 ); \ - int64_t len = stdlib_ndarray_length( x1 ); \ - uint8_t *px1; \ - uint8_t *px2; \ - uint8_t *px3; \ - int64_t i; \ - /* Iterate over each ndarray element based on the linear **view** index, regardless as to how the data is stored in memory... */ \ - for ( i = 0; i < len; i++ ) { \ - px1 = pbx1 + stdlib_ndarray_vind2bind( ndims, shape, sx1, ox1, ordx1, i, mx1 ); \ - px2 = pbx2 + stdlib_ndarray_vind2bind( ndims, shape, sx2, ox2, ordx2, i, mx2 ); \ - px3 = pbx3 + stdlib_ndarray_vind2bind( ndims, shape, sx3, ox3, ordx3, i, mx3 ); \ - do - -/** -* Macro containing the epilogue for nested loops which operate on elements of an n-dimensional ndarray. -* -* @example -* STDLIB_NDARRAY_UNARY_ND_LOOP_PREMABLE { -* // Innermost loop body... -* } -* STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE \ - while( 0 ); \ - } - -/** -* Macro for a unary n-dimensional ndarray loop which inlines an expression. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1` as `in1`. -* - Creates a pointer `tout *out` to the output ndarray element. -* - Expects a provided expression to operate on `tin in1` and to store the result in `tout *out`. -* -* @param tin input type -* @param tout output type -* @param expr expression to inline -* -* @example -* STDLIB_NDARRAY_UNARY_ND_LOOP_INLINE( double, double, *out = in1 * in1 ) -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_INLINE( tin, tout, expr ) \ - STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE { \ - const tin in1 = *(tin *)px1; \ - tout *out = (tout *)px2; \ - expr; \ - } \ - STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE - -/** -* Macro for a unary n-dimensional ndarray loop which invokes a callback. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( double, double ) -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( tin, tout ) \ - STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE - -/** -* Macro for a unary n-dimensional loop which invokes a callback and does not cast the return callback's return value (e.g., a `struct`). -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., z_z -* STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( tin, tout ) \ - STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = f( x ); \ - } \ - STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE - -/** -* Macro for a unary n-dimensional ndarray loop which invokes a callback requiring arguments be explicitly cast to a different type. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via the pointer `px1`. -* - Explicitly casts each function argument to `fin`. -* - Explicitly casts each function `f` invocation result to `tout`. -* - Stores the result in an output ndarray via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param fin callback argument type -* -* @example -* // e.g., f_f_as_d_d -* STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( float, float, double ) -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( tin, tout, fin ) \ - STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = (tout)f( (fin)x ); \ - } \ - STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE - -/** -* Macro for a unary n-dimensional ndarray loop which invokes a callback requiring arguments be cast to a different type via casting functions. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function argument via `cin`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cin input casting function -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., f_c_as_z_z -* STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( tin, tout, cin, cout ) \ - STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( cin( x ) ) ); \ - } \ - STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE - -/** -* Macro for a unary n-dimensional ndarray loop which invokes a callback whose return value must be cast to a different type via a casting function. -* -* ## Notes -* -* - Retrieves each ndarray element according to type `tin` via a pointer `px1`. -* - Explicitly casts each function `f` invocation result via `cout`. -* - Stores the result in an output ndarray of type `tout` via the pointer `px2`. -* -* @param tin input type -* @param tout output type -* @param cout output casting function -* -* @example -* #include "stdlib/complex/float64/ctor.h" -* -* // e.g., d_z -* STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) -*/ -#define STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( tin, tout, cout ) \ - STDLIB_NDARRAY_UNARY_ND_LOOP_PREAMBLE { \ - const tin x = *(tin *)px1; \ - *(tout *)px2 = cout( f( x ) ); \ - } \ - STDLIB_NDARRAY_UNARY_ND_LOOP_EPILOGUE - -#endif // !STDLIB_NDARRAY_BASE_UNARY_MACROS_ND_H diff --git a/include/stdlib/ndarray/base/unary/s_b.h b/include/stdlib/ndarray/base/unary/s_b.h deleted file mode 100644 index 176700a..0000000 --- a/include/stdlib/ndarray/base/unary/s_b.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_B_H -#define STDLIB_NDARRAY_BASE_UNARY_S_B_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_b( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_b_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_B_H diff --git a/include/stdlib/ndarray/base/unary/s_c.h b/include/stdlib/ndarray/base/unary/s_c.h deleted file mode 100644 index 6394bfe..0000000 --- a/include/stdlib/ndarray/base/unary/s_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_C_H -#define STDLIB_NDARRAY_BASE_UNARY_S_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_C_H diff --git a/include/stdlib/ndarray/base/unary/s_c_as_c_c.h b/include/stdlib/ndarray/base/unary/s_c_as_c_c.h deleted file mode 100644 index c0ca15b..0000000 --- a/include/stdlib/ndarray/base/unary/s_c_as_c_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_C_AS_C_C_H -#define STDLIB_NDARRAY_BASE_UNARY_S_C_AS_C_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_C_AS_C_C_H diff --git a/include/stdlib/ndarray/base/unary/s_c_as_s_c.h b/include/stdlib/ndarray/base/unary/s_c_as_s_c.h deleted file mode 100644 index 648796e..0000000 --- a/include/stdlib/ndarray/base/unary/s_c_as_s_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_C_AS_S_C_H -#define STDLIB_NDARRAY_BASE_UNARY_S_C_AS_S_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_s_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_C_AS_S_C_H diff --git a/include/stdlib/ndarray/base/unary/s_c_as_z_z.h b/include/stdlib/ndarray/base/unary/s_c_as_z_z.h deleted file mode 100644 index 0ad5eeb..0000000 --- a/include/stdlib/ndarray/base/unary/s_c_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_C_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_S_C_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_C_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/s_d.h b/include/stdlib/ndarray/base/unary/s_d.h deleted file mode 100644 index ae98d5c..0000000 --- a/include/stdlib/ndarray/base/unary/s_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_D_H -#define STDLIB_NDARRAY_BASE_UNARY_S_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_D_H diff --git a/include/stdlib/ndarray/base/unary/s_d_as_d_d.h b/include/stdlib/ndarray/base/unary/s_d_as_d_d.h deleted file mode 100644 index 144b0e0..0000000 --- a/include/stdlib/ndarray/base/unary/s_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_S_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/s_d_as_s_d.h b/include/stdlib/ndarray/base/unary/s_d_as_s_d.h deleted file mode 100644 index a019281..0000000 --- a/include/stdlib/ndarray/base/unary/s_d_as_s_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_D_AS_S_D_H -#define STDLIB_NDARRAY_BASE_UNARY_S_D_AS_S_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_d_as_s_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_D_AS_S_D_H diff --git a/include/stdlib/ndarray/base/unary/s_f.h b/include/stdlib/ndarray/base/unary/s_f.h deleted file mode 100644 index 5617215..0000000 --- a/include/stdlib/ndarray/base/unary/s_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_F_H -#define STDLIB_NDARRAY_BASE_UNARY_S_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_F_H diff --git a/include/stdlib/ndarray/base/unary/s_f_as_d_d.h b/include/stdlib/ndarray/base/unary/s_f_as_d_d.h deleted file mode 100644 index 31f1891..0000000 --- a/include/stdlib/ndarray/base/unary/s_f_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_F_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_S_F_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_F_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/s_f_as_f_f.h b/include/stdlib/ndarray/base/unary/s_f_as_f_f.h deleted file mode 100644 index 260d1fb..0000000 --- a/include/stdlib/ndarray/base/unary/s_f_as_f_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_F_AS_F_F_H -#define STDLIB_NDARRAY_BASE_UNARY_S_F_AS_F_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_F_AS_F_F_H diff --git a/include/stdlib/ndarray/base/unary/s_f_as_s_f.h b/include/stdlib/ndarray/base/unary/s_f_as_s_f.h deleted file mode 100644 index 31ce567..0000000 --- a/include/stdlib/ndarray/base/unary/s_f_as_s_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_F_AS_S_F_H -#define STDLIB_NDARRAY_BASE_UNARY_S_F_AS_S_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_f_as_s_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_F_AS_S_F_H diff --git a/include/stdlib/ndarray/base/unary/s_i.h b/include/stdlib/ndarray/base/unary/s_i.h deleted file mode 100644 index e1cdf51..0000000 --- a/include/stdlib/ndarray/base/unary/s_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_I_H diff --git a/include/stdlib/ndarray/base/unary/s_i_as_i_i.h b/include/stdlib/ndarray/base/unary/s_i_as_i_i.h deleted file mode 100644 index 1c8a308..0000000 --- a/include/stdlib/ndarray/base/unary/s_i_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_I_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_I_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_I_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/s_i_as_s_i.h b/include/stdlib/ndarray/base/unary/s_i_as_s_i.h deleted file mode 100644 index 5a0add7..0000000 --- a/include/stdlib/ndarray/base/unary/s_i_as_s_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_I_AS_S_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_I_AS_S_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_i_as_s_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_I_AS_S_I_H diff --git a/include/stdlib/ndarray/base/unary/s_k.h b/include/stdlib/ndarray/base/unary/s_k.h deleted file mode 100644 index 6cd7704..0000000 --- a/include/stdlib/ndarray/base/unary/s_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_K_H -#define STDLIB_NDARRAY_BASE_UNARY_S_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_K_H diff --git a/include/stdlib/ndarray/base/unary/s_k_as_i_i.h b/include/stdlib/ndarray/base/unary/s_k_as_i_i.h deleted file mode 100644 index 8d3856d..0000000 --- a/include/stdlib/ndarray/base/unary/s_k_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_K_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_K_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_K_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/s_k_as_k_k.h b/include/stdlib/ndarray/base/unary/s_k_as_k_k.h deleted file mode 100644 index e301d86..0000000 --- a/include/stdlib/ndarray/base/unary/s_k_as_k_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_K_AS_K_K_H -#define STDLIB_NDARRAY_BASE_UNARY_S_K_AS_K_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_k_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_K_AS_K_K_H diff --git a/include/stdlib/ndarray/base/unary/s_k_as_s_k.h b/include/stdlib/ndarray/base/unary/s_k_as_s_k.h deleted file mode 100644 index 981fc14..0000000 --- a/include/stdlib/ndarray/base/unary/s_k_as_s_k.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_K_AS_S_K_H -#define STDLIB_NDARRAY_BASE_UNARY_S_K_AS_S_K_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_k_as_s_k_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_K_AS_S_K_H diff --git a/include/stdlib/ndarray/base/unary/s_s.h b/include/stdlib/ndarray/base/unary/s_s.h deleted file mode 100644 index c633c3a..0000000 --- a/include/stdlib/ndarray/base/unary/s_s.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_S_H -#define STDLIB_NDARRAY_BASE_UNARY_S_S_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_s( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_S_H diff --git a/include/stdlib/ndarray/base/unary/s_s_as_i_i.h b/include/stdlib/ndarray/base/unary/s_s_as_i_i.h deleted file mode 100644 index 2d5b632..0000000 --- a/include/stdlib/ndarray/base/unary/s_s_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_S_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_S_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_s_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_S_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/s_t.h b/include/stdlib/ndarray/base/unary/s_t.h deleted file mode 100644 index 0581834..0000000 --- a/include/stdlib/ndarray/base/unary/s_t.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_T_H -#define STDLIB_NDARRAY_BASE_UNARY_S_T_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_t( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_T_H diff --git a/include/stdlib/ndarray/base/unary/s_t_as_i_i.h b/include/stdlib/ndarray/base/unary/s_t_as_i_i.h deleted file mode 100644 index 9c8cf81..0000000 --- a/include/stdlib/ndarray/base/unary/s_t_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_T_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_T_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_t_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_T_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/s_u.h b/include/stdlib/ndarray/base/unary/s_u.h deleted file mode 100644 index 6b7614a..0000000 --- a/include/stdlib/ndarray/base/unary/s_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_U_H -#define STDLIB_NDARRAY_BASE_UNARY_S_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_U_H diff --git a/include/stdlib/ndarray/base/unary/s_u_as_i_i.h b/include/stdlib/ndarray/base/unary/s_u_as_i_i.h deleted file mode 100644 index a2b9642..0000000 --- a/include/stdlib/ndarray/base/unary/s_u_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_U_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_S_U_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_u_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_U_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/s_z.h b/include/stdlib/ndarray/base/unary/s_z.h deleted file mode 100644 index c0f005d..0000000 --- a/include/stdlib/ndarray/base/unary/s_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_S_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_Z_H diff --git a/include/stdlib/ndarray/base/unary/s_z_as_s_z.h b/include/stdlib/ndarray/base/unary/s_z_as_s_z.h deleted file mode 100644 index 0fa31cd..0000000 --- a/include/stdlib/ndarray/base/unary/s_z_as_s_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_Z_AS_S_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_S_Z_AS_S_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_s_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_Z_AS_S_Z_H diff --git a/include/stdlib/ndarray/base/unary/s_z_as_z_z.h b/include/stdlib/ndarray/base/unary/s_z_as_z_z.h deleted file mode 100644 index 488af5a..0000000 --- a/include/stdlib/ndarray/base/unary/s_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_S_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_S_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_s_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_S_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/t_c.h b/include/stdlib/ndarray/base/unary/t_c.h deleted file mode 100644 index 27e7895..0000000 --- a/include/stdlib/ndarray/base/unary/t_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_C_H -#define STDLIB_NDARRAY_BASE_UNARY_T_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_C_H diff --git a/include/stdlib/ndarray/base/unary/t_c_as_c_c.h b/include/stdlib/ndarray/base/unary/t_c_as_c_c.h deleted file mode 100644 index 7239d40..0000000 --- a/include/stdlib/ndarray/base/unary/t_c_as_c_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_C_AS_C_C_H -#define STDLIB_NDARRAY_BASE_UNARY_T_C_AS_C_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_C_AS_C_C_H diff --git a/include/stdlib/ndarray/base/unary/t_c_as_t_c.h b/include/stdlib/ndarray/base/unary/t_c_as_t_c.h deleted file mode 100644 index 5809a44..0000000 --- a/include/stdlib/ndarray/base/unary/t_c_as_t_c.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_C_AS_T_C_H -#define STDLIB_NDARRAY_BASE_UNARY_T_C_AS_T_C_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_t_c_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_C_AS_T_C_H diff --git a/include/stdlib/ndarray/base/unary/t_c_as_z_z.h b/include/stdlib/ndarray/base/unary/t_c_as_z_z.h deleted file mode 100644 index e389ae3..0000000 --- a/include/stdlib/ndarray/base/unary/t_c_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_C_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_T_C_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_C_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/t_d.h b/include/stdlib/ndarray/base/unary/t_d.h deleted file mode 100644 index 54c99cb..0000000 --- a/include/stdlib/ndarray/base/unary/t_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_D_H -#define STDLIB_NDARRAY_BASE_UNARY_T_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_D_H diff --git a/include/stdlib/ndarray/base/unary/t_d_as_d_d.h b/include/stdlib/ndarray/base/unary/t_d_as_d_d.h deleted file mode 100644 index 7894640..0000000 --- a/include/stdlib/ndarray/base/unary/t_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_T_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/t_d_as_t_d.h b/include/stdlib/ndarray/base/unary/t_d_as_t_d.h deleted file mode 100644 index 77ddda7..0000000 --- a/include/stdlib/ndarray/base/unary/t_d_as_t_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_D_AS_T_D_H -#define STDLIB_NDARRAY_BASE_UNARY_T_D_AS_T_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_d_as_t_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_D_AS_T_D_H diff --git a/include/stdlib/ndarray/base/unary/t_f.h b/include/stdlib/ndarray/base/unary/t_f.h deleted file mode 100644 index cfd4b4d..0000000 --- a/include/stdlib/ndarray/base/unary/t_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_F_H -#define STDLIB_NDARRAY_BASE_UNARY_T_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_F_H diff --git a/include/stdlib/ndarray/base/unary/t_f_as_d_d.h b/include/stdlib/ndarray/base/unary/t_f_as_d_d.h deleted file mode 100644 index 6952ecf..0000000 --- a/include/stdlib/ndarray/base/unary/t_f_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_F_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_T_F_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_F_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/t_f_as_f_f.h b/include/stdlib/ndarray/base/unary/t_f_as_f_f.h deleted file mode 100644 index 83ff098..0000000 --- a/include/stdlib/ndarray/base/unary/t_f_as_f_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_F_AS_F_F_H -#define STDLIB_NDARRAY_BASE_UNARY_T_F_AS_F_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_F_AS_F_F_H diff --git a/include/stdlib/ndarray/base/unary/t_f_as_t_f.h b/include/stdlib/ndarray/base/unary/t_f_as_t_f.h deleted file mode 100644 index 24ccc8d..0000000 --- a/include/stdlib/ndarray/base/unary/t_f_as_t_f.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_F_AS_T_F_H -#define STDLIB_NDARRAY_BASE_UNARY_T_F_AS_T_F_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_f_as_t_f_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_F_AS_T_F_H diff --git a/include/stdlib/ndarray/base/unary/t_i.h b/include/stdlib/ndarray/base/unary/t_i.h deleted file mode 100644 index 5934a83..0000000 --- a/include/stdlib/ndarray/base/unary/t_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_I_H -#define STDLIB_NDARRAY_BASE_UNARY_T_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_I_H diff --git a/include/stdlib/ndarray/base/unary/t_i_as_i_i.h b/include/stdlib/ndarray/base/unary/t_i_as_i_i.h deleted file mode 100644 index c01e68b..0000000 --- a/include/stdlib/ndarray/base/unary/t_i_as_i_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_I_AS_I_I_H -#define STDLIB_NDARRAY_BASE_UNARY_T_I_AS_I_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_I_AS_I_I_H diff --git a/include/stdlib/ndarray/base/unary/t_i_as_t_i.h b/include/stdlib/ndarray/base/unary/t_i_as_t_i.h deleted file mode 100644 index bf8b6a2..0000000 --- a/include/stdlib/ndarray/base/unary/t_i_as_t_i.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_I_AS_T_I_H -#define STDLIB_NDARRAY_BASE_UNARY_T_I_AS_T_I_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_i_as_t_i_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_I_AS_T_I_H diff --git a/include/stdlib/ndarray/base/unary/t_t.h b/include/stdlib/ndarray/base/unary/t_t.h deleted file mode 100644 index e2b4108..0000000 --- a/include/stdlib/ndarray/base/unary/t_t.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_T_H -#define STDLIB_NDARRAY_BASE_UNARY_T_T_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_t( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_T_H diff --git a/include/stdlib/ndarray/base/unary/t_t_as_u_u.h b/include/stdlib/ndarray/base/unary/t_t_as_u_u.h deleted file mode 100644 index 5fbfa2d..0000000 --- a/include/stdlib/ndarray/base/unary/t_t_as_u_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_T_AS_U_U_H -#define STDLIB_NDARRAY_BASE_UNARY_T_T_AS_U_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_t_as_u_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_T_AS_U_U_H diff --git a/include/stdlib/ndarray/base/unary/t_u.h b/include/stdlib/ndarray/base/unary/t_u.h deleted file mode 100644 index 58167b4..0000000 --- a/include/stdlib/ndarray/base/unary/t_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_U_H -#define STDLIB_NDARRAY_BASE_UNARY_T_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_U_H diff --git a/include/stdlib/ndarray/base/unary/t_u_as_t_u.h b/include/stdlib/ndarray/base/unary/t_u_as_t_u.h deleted file mode 100644 index 372afe2..0000000 --- a/include/stdlib/ndarray/base/unary/t_u_as_t_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_U_AS_T_U_H -#define STDLIB_NDARRAY_BASE_UNARY_T_U_AS_T_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_t_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_U_AS_T_U_H diff --git a/include/stdlib/ndarray/base/unary/t_u_as_u_u.h b/include/stdlib/ndarray/base/unary/t_u_as_u_u.h deleted file mode 100644 index 0107c0f..0000000 --- a/include/stdlib/ndarray/base/unary/t_u_as_u_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_U_AS_U_U_H -#define STDLIB_NDARRAY_BASE_UNARY_T_U_AS_U_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_u_as_u_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_U_AS_U_U_H diff --git a/include/stdlib/ndarray/base/unary/t_z.h b/include/stdlib/ndarray/base/unary/t_z.h deleted file mode 100644 index b931ec5..0000000 --- a/include/stdlib/ndarray/base/unary/t_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_T_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_Z_H diff --git a/include/stdlib/ndarray/base/unary/t_z_as_t_z.h b/include/stdlib/ndarray/base/unary/t_z_as_t_z.h deleted file mode 100644 index df92a9b..0000000 --- a/include/stdlib/ndarray/base/unary/t_z_as_t_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_Z_AS_T_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_T_Z_AS_T_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_t_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_Z_AS_T_Z_H diff --git a/include/stdlib/ndarray/base/unary/t_z_as_z_z.h b/include/stdlib/ndarray/base/unary/t_z_as_z_z.h deleted file mode 100644 index bad28da..0000000 --- a/include/stdlib/ndarray/base/unary/t_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_T_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_T_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_t_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_T_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/typedefs.h b/include/stdlib/ndarray/base/unary/typedefs.h deleted file mode 100644 index bc1b99c..0000000 --- a/include/stdlib/ndarray/base/unary/typedefs.h +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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_BASE_UNARY_TYPEDEFS_H -#define STDLIB_NDARRAY_BASE_UNARY_TYPEDEFS_H - -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Function pointer type for a unary ndarray function. -* -* ## Note -* -* - This must match the definition of an `ndarrayFcn` found in `@stdlib/ndarray/base/function-object`. -* -* @param arrays array containing pointers to input and output ndarrays -* @param data function "data" (e.g., a callback) -* @return status code -*/ -typedef int8_t (*ndarrayUnaryFcn)( struct ndarray *arrays[], void *data ); - -#endif // !STDLIB_NDARRAY_BASE_UNARY_TYPEDEFS_H diff --git a/include/stdlib/ndarray/base/unary/u_d.h b/include/stdlib/ndarray/base/unary/u_d.h deleted file mode 100644 index 1f7566d..0000000 --- a/include/stdlib/ndarray/base/unary/u_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_D_H -#define STDLIB_NDARRAY_BASE_UNARY_U_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_D_H diff --git a/include/stdlib/ndarray/base/unary/u_d_as_d_d.h b/include/stdlib/ndarray/base/unary/u_d_as_d_d.h deleted file mode 100644 index 0c8479e..0000000 --- a/include/stdlib/ndarray/base/unary/u_d_as_d_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_D_AS_D_D_H -#define STDLIB_NDARRAY_BASE_UNARY_U_D_AS_D_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_D_AS_D_D_H diff --git a/include/stdlib/ndarray/base/unary/u_d_as_u_d.h b/include/stdlib/ndarray/base/unary/u_d_as_u_d.h deleted file mode 100644 index dd89168..0000000 --- a/include/stdlib/ndarray/base/unary/u_d_as_u_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_D_AS_U_D_H -#define STDLIB_NDARRAY_BASE_UNARY_U_D_AS_U_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_d_as_u_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_D_AS_U_D_H diff --git a/include/stdlib/ndarray/base/unary/u_u.h b/include/stdlib/ndarray/base/unary/u_u.h deleted file mode 100644 index c5a7e7a..0000000 --- a/include/stdlib/ndarray/base/unary/u_u.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_U_H -#define STDLIB_NDARRAY_BASE_UNARY_U_U_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_u( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_u_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_U_H diff --git a/include/stdlib/ndarray/base/unary/u_z.h b/include/stdlib/ndarray/base/unary/u_z.h deleted file mode 100644 index f8ceb31..0000000 --- a/include/stdlib/ndarray/base/unary/u_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_U_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_Z_H diff --git a/include/stdlib/ndarray/base/unary/u_z_as_u_z.h b/include/stdlib/ndarray/base/unary/u_z_as_u_z.h deleted file mode 100644 index f9caa84..0000000 --- a/include/stdlib/ndarray/base/unary/u_z_as_u_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_Z_AS_U_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_U_Z_AS_U_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_u_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_Z_AS_U_Z_H diff --git a/include/stdlib/ndarray/base/unary/u_z_as_z_z.h b/include/stdlib/ndarray/base/unary/u_z_as_z_z.h deleted file mode 100644 index cc4f059..0000000 --- a/include/stdlib/ndarray/base/unary/u_z_as_z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_U_Z_AS_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_U_Z_AS_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_u_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_U_Z_AS_Z_Z_H diff --git a/include/stdlib/ndarray/base/unary/x_x.h b/include/stdlib/ndarray/base/unary/x_x.h deleted file mode 100644 index d6287fd..0000000 --- a/include/stdlib/ndarray/base/unary/x_x.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_X_X_H -#define STDLIB_NDARRAY_BASE_UNARY_X_X_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_x_x( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_x_x_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_X_X_H diff --git a/include/stdlib/ndarray/base/unary/z_d_as_z_d.h b/include/stdlib/ndarray/base/unary/z_d_as_z_d.h deleted file mode 100644 index 153f54a..0000000 --- a/include/stdlib/ndarray/base/unary/z_d_as_z_d.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_Z_D_AS_Z_D_H -#define STDLIB_NDARRAY_BASE_UNARY_Z_D_AS_Z_D_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_d_as_z_d_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_Z_D_AS_Z_D_H diff --git a/include/stdlib/ndarray/base/unary/z_z.h b/include/stdlib/ndarray/base/unary/z_z.h deleted file mode 100644 index 4fbaa30..0000000 --- a/include/stdlib/ndarray/base/unary/z_z.h +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_Z_Z_H -#define STDLIB_NDARRAY_BASE_UNARY_Z_Z_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_z_z( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_z_z_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_Z_Z_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 96% rename from docs/types/index.d.ts rename to index.d.ts index 6f23e5e..b83b628 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -18,7 +18,7 @@ // TypeScript Version: 4.1 -/// +/// import { ArrayLike } from '@stdlib/types/array'; import { ndarray } from '@stdlib/types/ndarray'; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..e2d9ec1 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import r from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-iteration-order@v0.2.2-esm/index.mjs";import o from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-strides2order@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-minmax-view-buffer-index@v0.2.2-esm/index.mjs";import f from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-ndarraylike2object@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-unary-loop-interchange-order@v0.2.1-esm/index.mjs";import a from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-unary-tiling-block-size@v0.2.2-esm/index.mjs";import d from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-numel@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-vind2bind@v0.2.2-esm/index.mjs";var c="throw";var n="throw";var p=[function(r,o,s){o.data[o.offset]=s(r.data[r.offset])},function(r,o,s){var f,t,e,a,d,i,c,n;for(d=r.shape[0],e=r.strides[0],a=o.strides[0],i=r.offset,c=o.offset,f=r.data,t=o.data,n=0;n0;)for(z0;)for(E0;)for(G0;)for(F0;)for(D0;)for(N0;)for(M0;)for(L0;)for(K0;)for(V0;)for(U0;)for(T0;)for(S0;)for(R0;)for(rr0;)for(_0;)for($0;)for(Z0;)for(Y0;)for(X0;)for(dr0;)for(ar0;)for(er0;)for(tr0;)for(fr0;)for(sr0;)for(or0;)for(yr0;)for(vr0;)for(hr0;)for(pr0;)for(nr0;)for(cr0;)for(ir0;)for(dr0;)for(gr0;)for(br0;)for(jr0;)for(xr0;)for(lr0;)for(mr0;)for(ur0;)for(yr0;)for(vr0;)for(qr0;)for(Ar0;)for(zr0;)for(Er0;)for(kr0;)for(wr0;)for(Pr0;)for(gr0;)for(br0;)for(jr0;)for(q0;)for(A0;)for(I0;)for(H0;)for(G0;)for(Q0;)for(O0;)for(N0;)for(M0;)for(X0;)for(W0;)for(V0;)for(U0;)for(T0;)for(sr0;)for(or0;)for(rr0;)for(_0;)for($0;)for(Z0;)for(cr0;)for(ir0;)for(dr0;)for(ar0;)for(er0;)for(tr0;)for(fr0;)for(mr0;)for(ur0;)for(yr0;)for(vr0;)for(hr0;)for(pr0;)for(nr0;)for(cr0;)for(wr0;)for(Pr0;)for(gr0;)for(br0;)for(jr0;)for(xr0;)for(lr0;)for(mr0;)for(ur0;)for(Cr0;)for(Br0;)for(qr0;)for(Ar0;)for(zr0;)for(Er0;)for(kr0;)for(wr0;)for(Pr0;)for(gr} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unarynd( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unarynd( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar ordx;\n\tvar ordy;\n\tvar len;\n\tvar get;\n\tvar set;\n\tvar sh;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tsh = x.shape;\n\n\t// Compute the total number of elements over which to iterate:\n\tlen = numel( sh );\n\n\t// Cache references to the input and output ndarray data buffers:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache references to the respective stride arrays:\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays:\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache the respective array orders:\n\tordx = x.order;\n\tordy = y.order;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tix = vind2bind( sh, sx, ox, ordx, i, MODE );\n\t\tiy = vind2bind( sh, sy, oy, ordy, i, MODE );\n\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unarynd;\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 numel from '@stdlib/ndarray-base-numel';\nimport vind2bind from '@stdlib/ndarray-base-vind2bind';\n\n\n// VARIABLES //\n\nvar MODE = 'throw';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an n-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unarynd( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0 ]\n*/\nfunction unarynd( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar ordx;\n\tvar ordy;\n\tvar len;\n\tvar sh;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\tsh = x.shape;\n\n\t// Compute the total number of elements over which to iterate:\n\tlen = numel( sh );\n\n\t// Cache references to the input and output ndarray data buffers:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache references to the respective stride arrays:\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays:\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache the respective array orders:\n\tordx = x.order;\n\tordy = y.order;\n\n\t// Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tix = vind2bind( sh, sx, ox, ordx, i, MODE );\n\t\tiy = vind2bind( sh, sy, oy, ordy, i, MODE );\n\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unarynd;\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 iterationOrder from '@stdlib/ndarray-base-iteration-order';\nimport strides2order from '@stdlib/ndarray-base-strides2order';\nimport minmaxViewBufferIndex from '@stdlib/ndarray-base-minmax-view-buffer-index';\nimport ndarray2object from '@stdlib/ndarray-base-ndarraylike2object';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport blockedaccessorunary2d from './2d_blocked_accessors.js';\nimport blockedaccessorunary3d from './3d_blocked_accessors.js';\nimport blockedaccessorunary4d from './4d_blocked_accessors.js';\nimport blockedaccessorunary5d from './5d_blocked_accessors.js';\nimport blockedaccessorunary6d from './6d_blocked_accessors.js';\nimport blockedaccessorunary7d from './7d_blocked_accessors.js';\nimport blockedaccessorunary8d from './8d_blocked_accessors.js';\nimport blockedaccessorunary9d from './9d_blocked_accessors.js';\nimport blockedaccessorunary10d from './10d_blocked_accessors.js';\nimport blockedunary2d from './2d_blocked.js';\nimport blockedunary3d from './3d_blocked.js';\nimport blockedunary4d from './4d_blocked.js';\nimport blockedunary5d from './5d_blocked.js';\nimport blockedunary6d from './6d_blocked.js';\nimport blockedunary7d from './7d_blocked.js';\nimport blockedunary8d from './8d_blocked.js';\nimport blockedunary9d from './9d_blocked.js';\nimport blockedunary10d from './10d_blocked.js';\nimport accessorunary0d from './0d_accessors.js';\nimport accessorunary1d from './1d_accessors.js';\nimport accessorunary2d from './2d_accessors.js';\nimport accessorunary3d from './3d_accessors.js';\nimport accessorunary4d from './4d_accessors.js';\nimport accessorunary5d from './5d_accessors.js';\nimport accessorunary6d from './6d_accessors.js';\nimport accessorunary7d from './7d_accessors.js';\nimport accessorunary8d from './8d_accessors.js';\nimport accessorunary9d from './9d_accessors.js';\nimport accessorunary10d from './10d_accessors.js';\nimport accessorunarynd from './nd_accessors.js';\nimport unary0d from './0d.js';\nimport unary1d from './1d.js';\nimport unary2d from './2d.js';\nimport unary3d from './3d.js';\nimport unary4d from './4d.js';\nimport unary5d from './5d.js';\nimport unary6d from './6d.js';\nimport unary7d from './7d.js';\nimport unary8d from './8d.js';\nimport unary9d from './9d.js';\nimport unary10d from './10d.js';\nimport unarynd from './nd.js';\n\n\n// VARIABLES //\n\nvar UNARY = [\n\tunary0d,\n\tunary1d,\n\tunary2d,\n\tunary3d,\n\tunary4d,\n\tunary5d,\n\tunary6d,\n\tunary7d,\n\tunary8d,\n\tunary9d,\n\tunary10d\n];\nvar ACCESSOR_UNARY = [\n\taccessorunary0d,\n\taccessorunary1d,\n\taccessorunary2d,\n\taccessorunary3d,\n\taccessorunary4d,\n\taccessorunary5d,\n\taccessorunary6d,\n\taccessorunary7d,\n\taccessorunary8d,\n\taccessorunary9d,\n\taccessorunary10d\n];\nvar BLOCKED_UNARY = [\n\tblockedunary2d, // 0\n\tblockedunary3d,\n\tblockedunary4d,\n\tblockedunary5d,\n\tblockedunary6d,\n\tblockedunary7d,\n\tblockedunary8d,\n\tblockedunary9d,\n\tblockedunary10d // 8\n];\nvar BLOCKED_ACCESSOR_UNARY = [\n\tblockedaccessorunary2d, // 0\n\tblockedaccessorunary3d,\n\tblockedaccessorunary4d,\n\tblockedaccessorunary5d,\n\tblockedaccessorunary6d,\n\tblockedaccessorunary7d,\n\tblockedaccessorunary8d,\n\tblockedaccessorunary9d,\n\tblockedaccessorunary10d // 8\n];\nvar MAX_DIMS = UNARY.length - 1;\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an input ndarray and assigns results to elements in an output ndarray.\n*\n* ## Notes\n*\n* - Each provided ndarray should be an `object` with the following properties:\n*\n* - **dtype**: data type.\n* - **data**: data buffer.\n* - **shape**: dimensions.\n* - **strides**: stride lengths.\n* - **offset**: index offset.\n* - **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style).\n*\n* @param {ArrayLikeObject} arrays - array-like object containing one input array and one output array\n* @param {Callback} fcn - unary callback\n* @throws {Error} arrays must have the same number of dimensions\n* @throws {Error} arrays must have the same shape\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary( [ x, y ], scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary( arrays, fcn ) {\n\tvar ndims;\n\tvar xmmv;\n\tvar ymmv;\n\tvar shx;\n\tvar shy;\n\tvar iox;\n\tvar ioy;\n\tvar len;\n\tvar ord;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ns;\n\tvar x;\n\tvar y;\n\tvar d;\n\tvar i;\n\n\t// Unpack the ndarrays and standardize ndarray meta data:\n\tx = ndarray2object( arrays[ 0 ] );\n\ty = ndarray2object( arrays[ 1 ] );\n\n\t// Verify that the input and output arrays have the same number of dimensions...\n\tshx = x.shape;\n\tshy = y.shape;\n\tndims = shx.length;\n\tif ( ndims !== shy.length ) {\n\t\tthrow new Error( format( 'invalid arguments. Arrays must have the same number of dimensions (i.e., same rank). ndims(x) == %d. ndims(y) == %d.', ndims, shy.length ) );\n\t}\n\t// Determine whether we can avoid iteration altogether...\n\tif ( ndims === 0 ) {\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn ACCESSOR_UNARY[ ndims ]( x, y, fcn );\n\t\t}\n\t\treturn UNARY[ ndims ]( x, y, fcn );\n\t}\n\t// Verify that the input and output arrays have the same dimensions...\n\tlen = 1; // number of elements\n\tns = 0; // number of singleton dimensions\n\tfor ( i = 0; i < ndims; i++ ) {\n\t\td = shx[ i ];\n\t\tif ( d !== shy[ i ] ) {\n\t\t\tthrow new Error( format('0jd0d') );\n\t\t}\n\t\t// Note that, if one of the dimensions is `0`, the length will be `0`...\n\t\tlen *= d;\n\n\t\t// Check whether the current dimension is a singleton dimension...\n\t\tif ( d === 1 ) {\n\t\t\tns += 1;\n\t\t}\n\t}\n\t// Check whether we were provided empty ndarrays...\n\tif ( len === 0 ) {\n\t\treturn;\n\t}\n\t// Determine whether the ndarrays are one-dimensional and thus readily translate to one-dimensional strided arrays...\n\tif ( ndims === 1 ) {\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn ACCESSOR_UNARY[ ndims ]( x, y, fcn );\n\t\t}\n\t\treturn UNARY[ ndims ]( x, y, fcn );\n\t}\n\tsx = x.strides;\n\tsy = y.strides;\n\n\t// Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays...\n\tif ( ns === ndims-1 ) {\n\t\t// Get the index of the non-singleton dimension...\n\t\tfor ( i = 0; i < ndims; i++ ) {\n\t\t\tif ( shx[ i ] !== 1 ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tx.shape = [ shx[i] ];\n\t\ty.shape = x.shape;\n\t\tx.strides = [ sx[i] ];\n\t\ty.strides = [ sy[i] ];\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn ACCESSOR_UNARY[ 1 ]( x, y, fcn );\n\t\t}\n\t\treturn UNARY[ 1 ]( x, y, fcn );\n\t}\n\tiox = iterationOrder( sx ); // +/-1\n\tioy = iterationOrder( sy ); // +/-1\n\n\t// Determine whether we can avoid blocked iteration...\n\tord = strides2order( sx );\n\tif ( iox !== 0 && ioy !== 0 && ord === strides2order( sy ) ) {\n\t\t// Determine the minimum and maximum linear indices which are accessible by the array views:\n\t\txmmv = minmaxViewBufferIndex( shx, sx, x.offset );\n\t\tymmv = minmaxViewBufferIndex( shy, sy, y.offset );\n\n\t\t// Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays...\n\t\tif ( len === ( xmmv[1]-xmmv[0]+1 ) && len === ( ymmv[1]-ymmv[0]+1 ) ) {\n\t\t\t// Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values...\n\t\t\tif ( iox === 1 ) {\n\t\t\t\tox = xmmv[ 0 ];\n\t\t\t} else {\n\t\t\t\tox = xmmv[ 1 ];\n\t\t\t}\n\t\t\tif ( ioy === 1 ) {\n\t\t\t\toy = ymmv[ 0 ];\n\t\t\t} else {\n\t\t\t\toy = ymmv[ 1 ];\n\t\t\t}\n\t\t\tx.shape = [ len ];\n\t\t\ty.shape = x.shape;\n\t\t\tx.strides = [ iox ];\n\t\t\ty.strides = [ ioy ];\n\t\t\tx.offset = ox;\n\t\t\ty.offset = oy;\n\t\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\t\treturn ACCESSOR_UNARY[ 1 ]( x, y, fcn );\n\t\t\t}\n\t\t\treturn UNARY[ 1 ]( x, y, fcn );\n\t\t}\n\t\t// At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality...\n\n\t\t// Determine whether we can use simple nested loops...\n\t\tif ( ndims <= MAX_DIMS ) {\n\t\t\t// So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration...\n\t\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\t\treturn ACCESSOR_UNARY[ ndims ]( x, y, ord, fcn );\n\t\t\t}\n\t\t\treturn UNARY[ ndims ]( x, y, ord, fcn );\n\t\t}\n\t\t// Fall-through to blocked iteration...\n\t}\n\t// At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration...\n\n\t// Determine whether we can perform blocked iteration...\n\tif ( ndims <= MAX_DIMS ) {\n\t\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\t\treturn BLOCKED_ACCESSOR_UNARY[ ndims-2 ]( x, y, fcn );\n\t\t}\n\t\treturn BLOCKED_UNARY[ ndims-2 ]( x, y, fcn );\n\t}\n\t// Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)...\n\tif ( x.accessorProtocol || y.accessorProtocol ) {\n\t\treturn accessorunarynd( x, y, fcn );\n\t}\n\tunarynd( x, y, fcn );\n}\n\n\n// EXPORTS //\n\nexport default unary;\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* Applies a unary callback to elements in a zero-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0 ] );\n* var ybuf = new Float64Array( 1 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [];\n*\n* // Define the array strides:\n* var sx = [ 0 ];\n* var sy = [ 0 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary0d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0 ]\n*/\nfunction unary0d( x, y, fcn ) {\n\ty.data[ y.offset ] = fcn( x.data[ x.offset ] );\n}\n\n\n// EXPORTS //\n\nexport default unary0d;\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* Applies a unary callback to elements in a one-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 4 ];\n*\n* // Define the array strides:\n* var sx = [ 2 ];\n* var sy = [ 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary1d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 40.0, 60.0, 80.0 ]\n*/\nfunction unary1d( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dy0;\n\tvar S0;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables: dimensions and loop offset (pointer) increments...\n\tS0 = x.shape[ 0 ];\n\tdx0 = x.strides[ 0 ];\n\tdy0 = y.strides[ 0 ];\n\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\tix += dx0;\n\t\tiy += dy0;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary1d;\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* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary2d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0 ]\n*/\nfunction unary2d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 1 ];\n\t\tS1 = sh[ 0 ];\n\t\tdx0 = sx[ 1 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 1 ];\n\t\tdy1 = sy[ 0 ] - ( S0*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\tix += dx0;\n\t\t\tiy += dy0;\n\t\t}\n\t\tix += dx1;\n\t\tiy += dy1;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary2d;\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* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary3d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary3d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 2 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 0 ];\n\t\tdx0 = sx[ 2 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[2] );\n\t\tdx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 2 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[2] );\n\t\tdy2 = sy[ 0 ] - ( S1*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\tix += dx0;\n\t\t\t\tiy += dy0;\n\t\t\t}\n\t\t\tix += dx1;\n\t\t\tiy += dy1;\n\t\t}\n\t\tix += dx2;\n\t\tiy += dy2;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary3d;\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* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 4, 4, 1 ];\n* var sy = [ 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary4d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary4d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 3 ];\n\t\tS1 = sh[ 2 ];\n\t\tS2 = sh[ 1 ];\n\t\tS3 = sh[ 0 ];\n\t\tdx0 = sx[ 3 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 2 ] - ( S0*sx[3] );\n\t\tdx2 = sx[ 1 ] - ( S1*sx[2] );\n\t\tdx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 3 ];\n\t\tdy1 = sy[ 2 ] - ( S0*sy[3] );\n\t\tdy2 = sy[ 1 ] - ( S1*sy[2] );\n\t\tdy3 = sy[ 0 ] - ( S2*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t\tix += dx2;\n\t\t\tiy += dy2;\n\t\t}\n\t\tix += dx3;\n\t\tiy += dy3;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary4d;\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* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary5d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary5d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 4 ];\n\t\tS1 = sh[ 3 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 1 ];\n\t\tS4 = sh[ 0 ];\n\t\tdx0 = sx[ 4 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 3 ] - ( S0*sx[4] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[3] );\n\t\tdx3 = sx[ 1 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 4 ];\n\t\tdy1 = sy[ 3 ] - ( S0*sy[4] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[3] );\n\t\tdy3 = sy[ 1 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 0 ] - ( S3*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx1;\n\t\t\t\t\tiy += dy1;\n\t\t\t\t}\n\t\t\t\tix += dx2;\n\t\t\t\tiy += dy2;\n\t\t\t}\n\t\t\tix += dx3;\n\t\t\tiy += dy3;\n\t\t}\n\t\tix += dx4;\n\t\tiy += dy4;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary5d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary6d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary6d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 5 ];\n\t\tS1 = sh[ 4 ];\n\t\tS2 = sh[ 3 ];\n\t\tS3 = sh[ 2 ];\n\t\tS4 = sh[ 1 ];\n\t\tS5 = sh[ 0 ];\n\t\tdx0 = sx[ 5 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 4 ] - ( S0*sx[5] );\n\t\tdx2 = sx[ 3 ] - ( S1*sx[4] );\n\t\tdx3 = sx[ 2 ] - ( S2*sx[3] );\n\t\tdx4 = sx[ 1 ] - ( S3*sx[2] );\n\t\tdx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 5 ];\n\t\tdy1 = sy[ 4 ] - ( S0*sy[5] );\n\t\tdy2 = sy[ 3 ] - ( S1*sy[4] );\n\t\tdy3 = sy[ 2 ] - ( S2*sy[3] );\n\t\tdy4 = sy[ 1 ] - ( S3*sy[2] );\n\t\tdy5 = sy[ 0 ] - ( S4*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t\tix += dx3;\n\t\t\t\tiy += dy3;\n\t\t\t}\n\t\t\tix += dx4;\n\t\t\tiy += dy4;\n\t\t}\n\t\tix += dx5;\n\t\tiy += dy5;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary6d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary7d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary7d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 6 ];\n\t\tS1 = sh[ 5 ];\n\t\tS2 = sh[ 4 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 2 ];\n\t\tS5 = sh[ 1 ];\n\t\tS6 = sh[ 0 ];\n\t\tdx0 = sx[ 6 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 5 ] - ( S0*sx[6] );\n\t\tdx2 = sx[ 4 ] - ( S1*sx[5] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[4] );\n\t\tdx4 = sx[ 2 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 1 ] - ( S4*sx[2] );\n\t\tdx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 6 ];\n\t\tdy1 = sy[ 5 ] - ( S0*sy[6] );\n\t\tdy2 = sy[ 4 ] - ( S1*sy[5] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[4] );\n\t\tdy4 = sy[ 2 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 1 ] - ( S4*sy[2] );\n\t\tdy6 = sy[ 0 ] - ( S5*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx3;\n\t\t\t\t\tiy += dy3;\n\t\t\t\t}\n\t\t\t\tix += dx4;\n\t\t\t\tiy += dy4;\n\t\t\t}\n\t\t\tix += dx5;\n\t\t\tiy += dy5;\n\t\t}\n\t\tix += dx6;\n\t\tiy += dy6;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary7d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary8d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary8d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 7 ];\n\t\tS1 = sh[ 6 ];\n\t\tS2 = sh[ 5 ];\n\t\tS3 = sh[ 4 ];\n\t\tS4 = sh[ 3 ];\n\t\tS5 = sh[ 2 ];\n\t\tS6 = sh[ 1 ];\n\t\tS7 = sh[ 0 ];\n\t\tdx0 = sx[ 7 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 6 ] - ( S0*sx[7] );\n\t\tdx2 = sx[ 5 ] - ( S1*sx[6] );\n\t\tdx3 = sx[ 4 ] - ( S2*sx[5] );\n\t\tdx4 = sx[ 3 ] - ( S3*sx[4] );\n\t\tdx5 = sx[ 2 ] - ( S4*sx[3] );\n\t\tdx6 = sx[ 1 ] - ( S5*sx[2] );\n\t\tdx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 7 ];\n\t\tdy1 = sy[ 6 ] - ( S0*sy[7] );\n\t\tdy2 = sy[ 5 ] - ( S1*sy[6] );\n\t\tdy3 = sy[ 4 ] - ( S2*sy[5] );\n\t\tdy4 = sy[ 3 ] - ( S3*sy[4] );\n\t\tdy5 = sy[ 2 ] - ( S4*sy[3] );\n\t\tdy6 = sy[ 1 ] - ( S5*sy[2] );\n\t\tdy7 = sy[ 0 ] - ( S6*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx4;\n\t\t\t\t\tiy += dy4;\n\t\t\t\t}\n\t\t\t\tix += dx5;\n\t\t\t\tiy += dy5;\n\t\t\t}\n\t\t\tix += dx6;\n\t\t\tiy += dy6;\n\t\t}\n\t\tix += dx7;\n\t\tiy += dy7;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary8d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary9d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary9d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 8 ];\n\t\tS1 = sh[ 7 ];\n\t\tS2 = sh[ 6 ];\n\t\tS3 = sh[ 5 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 3 ];\n\t\tS6 = sh[ 2 ];\n\t\tS7 = sh[ 1 ];\n\t\tS8 = sh[ 0 ];\n\t\tdx0 = sx[ 8 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 7 ] - ( S0*sx[8] );\n\t\tdx2 = sx[ 6 ] - ( S1*sx[7] );\n\t\tdx3 = sx[ 5 ] - ( S2*sx[6] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[5] );\n\t\tdx5 = sx[ 3 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 2 ] - ( S5*sx[3] );\n\t\tdx7 = sx[ 1 ] - ( S6*sx[2] );\n\t\tdx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 8 ];\n\t\tdy1 = sy[ 7 ] - ( S0*sy[8] );\n\t\tdy2 = sy[ 6 ] - ( S1*sy[7] );\n\t\tdy3 = sy[ 5 ] - ( S2*sy[6] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[5] );\n\t\tdy5 = sy[ 3 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 2 ] - ( S5*sy[3] );\n\t\tdy7 = sy[ 1 ] - ( S6*sy[2] );\n\t\tdy8 = sy[ 0 ] - ( S7*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx5;\n\t\t\t\t\tiy += dy5;\n\t\t\t\t}\n\t\t\t\tix += dx6;\n\t\t\t\tiy += dy6;\n\t\t\t}\n\t\t\tix += dx7;\n\t\t\tiy += dy7;\n\t\t}\n\t\tix += dx8;\n\t\tiy += dy8;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary9d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* unary10d( x, y, true, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar S9;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 9 ];\n\t\tS1 = sh[ 8 ];\n\t\tS2 = sh[ 7 ];\n\t\tS3 = sh[ 6 ];\n\t\tS4 = sh[ 5 ];\n\t\tS5 = sh[ 4 ];\n\t\tS6 = sh[ 3 ];\n\t\tS7 = sh[ 2 ];\n\t\tS8 = sh[ 1 ];\n\t\tS9 = sh[ 0 ];\n\t\tdx0 = sx[ 9 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 8 ] - ( S0*sx[9] );\n\t\tdx2 = sx[ 7 ] - ( S1*sx[8] );\n\t\tdx3 = sx[ 6 ] - ( S2*sx[7] );\n\t\tdx4 = sx[ 5 ] - ( S3*sx[6] );\n\t\tdx5 = sx[ 4 ] - ( S4*sx[5] );\n\t\tdx6 = sx[ 3 ] - ( S5*sx[4] );\n\t\tdx7 = sx[ 2 ] - ( S6*sx[3] );\n\t\tdx8 = sx[ 1 ] - ( S7*sx[2] );\n\t\tdx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 9 ];\n\t\tdy1 = sy[ 8 ] - ( S0*sy[9] );\n\t\tdy2 = sy[ 7 ] - ( S1*sy[8] );\n\t\tdy3 = sy[ 6 ] - ( S2*sy[7] );\n\t\tdy4 = sy[ 5 ] - ( S3*sy[6] );\n\t\tdy5 = sy[ 4 ] - ( S4*sy[5] );\n\t\tdy6 = sy[ 3 ] - ( S5*sy[4] );\n\t\tdy7 = sy[ 2 ] - ( S6*sy[3] );\n\t\tdy8 = sy[ 1 ] - ( S7*sy[2] );\n\t\tdy9 = sy[ 0 ] - ( S8*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tS9 = sh[ 9 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] );\n\t\tdx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t\tdy9 = sy[ 9 ] - ( S8*sy[8] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i9 = 0; i9 < S9; i9++ ) {\n\t\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx6;\n\t\t\t\t\tiy += dy6;\n\t\t\t\t}\n\t\t\t\tix += dx7;\n\t\t\t\tiy += dy7;\n\t\t\t}\n\t\t\tix += dx8;\n\t\t\tiy += dy8;\n\t\t}\n\t\tix += dx9;\n\t\tiy += dy9;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary10d;\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* Applies a unary callback to elements in a zero-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] );\n* var ybuf = new Complex64Array( 2 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [];\n*\n* // Define the array strides:\n* var sx = [ 0 ];\n* var sy = [ 0 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary0d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 30.0\n*\n* var im = imagf( v );\n* // returns 40.0\n*/\nfunction unary0d( x, y, fcn ) {\n\ty.accessors[ 1 ]( y.data, y.offset, fcn( x.accessors[ 0 ]( x.data, x.offset ) ) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default unary0d;\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* Applies a unary callback to elements in a one-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 4 ];\n*\n* // Define the array strides:\n* var sx = [ 1 ];\n* var sy = [ 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary1d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary1d( x, y, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dy0;\n\tvar S0;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables: dimensions and loop offset (pointer) increments...\n\tS0 = x.shape[ 0 ];\n\tdx0 = x.strides[ 0 ];\n\tdy0 = y.strides[ 0 ];\n\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\tix += dx0;\n\t\tiy += dy0;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary1d;\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* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary2d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary2d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 1 ];\n\t\tS1 = sh[ 0 ];\n\t\tdx0 = sx[ 1 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 1 ];\n\t\tdy1 = sy[ 0 ] - ( S0*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\tix += dx0;\n\t\t\tiy += dy0;\n\t\t}\n\t\tix += dx1;\n\t\tiy += dy1;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary2d;\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* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 2, 1 ];\n* var sy = [ 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary3d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary3d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 2 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 0 ];\n\t\tdx0 = sx[ 2 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[2] );\n\t\tdx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 2 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[2] );\n\t\tdy2 = sy[ 0 ] - ( S1*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\tix += dx0;\n\t\t\t\tiy += dy0;\n\t\t\t}\n\t\t\tix += dx1;\n\t\t\tiy += dy1;\n\t\t}\n\t\tix += dx2;\n\t\tiy += dy2;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary3d;\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* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary4d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary4d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 3 ];\n\t\tS1 = sh[ 2 ];\n\t\tS2 = sh[ 1 ];\n\t\tS3 = sh[ 0 ];\n\t\tdx0 = sx[ 3 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 2 ] - ( S0*sx[3] );\n\t\tdx2 = sx[ 1 ] - ( S1*sx[2] );\n\t\tdx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 3 ];\n\t\tdy1 = sy[ 2 ] - ( S0*sy[3] );\n\t\tdy2 = sy[ 1 ] - ( S1*sy[2] );\n\t\tdy3 = sy[ 0 ] - ( S2*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t\tix += dx2;\n\t\t\tiy += dy2;\n\t\t}\n\t\tix += dx3;\n\t\tiy += dy3;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary4d;\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* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary5d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary5d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 4 ];\n\t\tS1 = sh[ 3 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 1 ];\n\t\tS4 = sh[ 0 ];\n\t\tdx0 = sx[ 4 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 3 ] - ( S0*sx[4] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[3] );\n\t\tdx3 = sx[ 1 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 4 ];\n\t\tdy1 = sy[ 3 ] - ( S0*sy[4] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[3] );\n\t\tdy3 = sy[ 1 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 0 ] - ( S3*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx1;\n\t\t\t\t\tiy += dy1;\n\t\t\t\t}\n\t\t\t\tix += dx2;\n\t\t\t\tiy += dy2;\n\t\t\t}\n\t\t\tix += dx3;\n\t\t\tiy += dy3;\n\t\t}\n\t\tix += dx4;\n\t\tiy += dy4;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary5d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary6d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary6d( x, y, isRowMajor, fcn ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 5 ];\n\t\tS1 = sh[ 4 ];\n\t\tS2 = sh[ 3 ];\n\t\tS3 = sh[ 2 ];\n\t\tS4 = sh[ 1 ];\n\t\tS5 = sh[ 0 ];\n\t\tdx0 = sx[ 5 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 4 ] - ( S0*sx[5] );\n\t\tdx2 = sx[ 3 ] - ( S1*sx[4] );\n\t\tdx3 = sx[ 2 ] - ( S2*sx[3] );\n\t\tdx4 = sx[ 1 ] - ( S3*sx[2] );\n\t\tdx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 5 ];\n\t\tdy1 = sy[ 4 ] - ( S0*sy[5] );\n\t\tdy2 = sy[ 3 ] - ( S1*sy[4] );\n\t\tdy3 = sy[ 2 ] - ( S2*sy[3] );\n\t\tdy4 = sy[ 1 ] - ( S3*sy[2] );\n\t\tdy5 = sy[ 0 ] - ( S4*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t\tix += dx3;\n\t\t\t\tiy += dy3;\n\t\t\t}\n\t\t\tix += dx4;\n\t\t\tiy += dy4;\n\t\t}\n\t\tix += dx5;\n\t\tiy += dy5;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary6d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary7d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary7d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 6 ];\n\t\tS1 = sh[ 5 ];\n\t\tS2 = sh[ 4 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 2 ];\n\t\tS5 = sh[ 1 ];\n\t\tS6 = sh[ 0 ];\n\t\tdx0 = sx[ 6 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 5 ] - ( S0*sx[6] );\n\t\tdx2 = sx[ 4 ] - ( S1*sx[5] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[4] );\n\t\tdx4 = sx[ 2 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 1 ] - ( S4*sx[2] );\n\t\tdx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 6 ];\n\t\tdy1 = sy[ 5 ] - ( S0*sy[6] );\n\t\tdy2 = sy[ 4 ] - ( S1*sy[5] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[4] );\n\t\tdy4 = sy[ 2 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 1 ] - ( S4*sy[2] );\n\t\tdy6 = sy[ 0 ] - ( S5*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx3;\n\t\t\t\t\tiy += dy3;\n\t\t\t\t}\n\t\t\t\tix += dx4;\n\t\t\t\tiy += dy4;\n\t\t\t}\n\t\t\tix += dx5;\n\t\t\tiy += dy5;\n\t\t}\n\t\tix += dx6;\n\t\tiy += dy6;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary7d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary8d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary8d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 7 ];\n\t\tS1 = sh[ 6 ];\n\t\tS2 = sh[ 5 ];\n\t\tS3 = sh[ 4 ];\n\t\tS4 = sh[ 3 ];\n\t\tS5 = sh[ 2 ];\n\t\tS6 = sh[ 1 ];\n\t\tS7 = sh[ 0 ];\n\t\tdx0 = sx[ 7 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 6 ] - ( S0*sx[7] );\n\t\tdx2 = sx[ 5 ] - ( S1*sx[6] );\n\t\tdx3 = sx[ 4 ] - ( S2*sx[5] );\n\t\tdx4 = sx[ 3 ] - ( S3*sx[4] );\n\t\tdx5 = sx[ 2 ] - ( S4*sx[3] );\n\t\tdx6 = sx[ 1 ] - ( S5*sx[2] );\n\t\tdx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 7 ];\n\t\tdy1 = sy[ 6 ] - ( S0*sy[7] );\n\t\tdy2 = sy[ 5 ] - ( S1*sy[6] );\n\t\tdy3 = sy[ 4 ] - ( S2*sy[5] );\n\t\tdy4 = sy[ 3 ] - ( S3*sy[4] );\n\t\tdy5 = sy[ 2 ] - ( S4*sy[3] );\n\t\tdy6 = sy[ 1 ] - ( S5*sy[2] );\n\t\tdy7 = sy[ 0 ] - ( S6*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx4;\n\t\t\t\t\tiy += dy4;\n\t\t\t\t}\n\t\t\t\tix += dx5;\n\t\t\t\tiy += dy5;\n\t\t\t}\n\t\t\tix += dx6;\n\t\t\tiy += dy6;\n\t\t}\n\t\tix += dx7;\n\t\tiy += dy7;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary8d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary9d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary9d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 8 ];\n\t\tS1 = sh[ 7 ];\n\t\tS2 = sh[ 6 ];\n\t\tS3 = sh[ 5 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 3 ];\n\t\tS6 = sh[ 2 ];\n\t\tS7 = sh[ 1 ];\n\t\tS8 = sh[ 0 ];\n\t\tdx0 = sx[ 8 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 7 ] - ( S0*sx[8] );\n\t\tdx2 = sx[ 6 ] - ( S1*sx[7] );\n\t\tdx3 = sx[ 5 ] - ( S2*sx[6] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[5] );\n\t\tdx5 = sx[ 3 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 2 ] - ( S5*sx[3] );\n\t\tdx7 = sx[ 1 ] - ( S6*sx[2] );\n\t\tdx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 8 ];\n\t\tdy1 = sy[ 7 ] - ( S0*sy[8] );\n\t\tdy2 = sy[ 6 ] - ( S1*sy[7] );\n\t\tdy3 = sy[ 5 ] - ( S2*sy[6] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[5] );\n\t\tdy5 = sy[ 3 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 2 ] - ( S5*sy[3] );\n\t\tdy7 = sy[ 1 ] - ( S6*sy[2] );\n\t\tdy8 = sy[ 0 ] - ( S7*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx5;\n\t\t\t\t\tiy += dy5;\n\t\t\t\t}\n\t\t\t\tix += dx6;\n\t\t\t\tiy += dy6;\n\t\t\t}\n\t\t\tix += dx7;\n\t\t\tiy += dy7;\n\t\t}\n\t\tix += dx8;\n\t\tiy += dy8;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary9d;\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 max-depth */\n\n'use strict';\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order\n* @param {Callback} fcn - unary callback\n* @returns {void}\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* unary10d( x, y, true, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar sh;\n\tvar S0;\n\tvar S1;\n\tvar S2;\n\tvar S3;\n\tvar S4;\n\tvar S5;\n\tvar S6;\n\tvar S7;\n\tvar S8;\n\tvar S9;\n\tvar sx;\n\tvar sy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\n\t// Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments...\n\tsh = x.shape;\n\tsx = x.strides;\n\tsy = y.strides;\n\tif ( isRowMajor ) {\n\t\t// For row-major ndarrays, the last dimensions have the fastest changing indices...\n\t\tS0 = sh[ 9 ];\n\t\tS1 = sh[ 8 ];\n\t\tS2 = sh[ 7 ];\n\t\tS3 = sh[ 6 ];\n\t\tS4 = sh[ 5 ];\n\t\tS5 = sh[ 4 ];\n\t\tS6 = sh[ 3 ];\n\t\tS7 = sh[ 2 ];\n\t\tS8 = sh[ 1 ];\n\t\tS9 = sh[ 0 ];\n\t\tdx0 = sx[ 9 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 8 ] - ( S0*sx[9] );\n\t\tdx2 = sx[ 7 ] - ( S1*sx[8] );\n\t\tdx3 = sx[ 6 ] - ( S2*sx[7] );\n\t\tdx4 = sx[ 5 ] - ( S3*sx[6] );\n\t\tdx5 = sx[ 4 ] - ( S4*sx[5] );\n\t\tdx6 = sx[ 3 ] - ( S5*sx[4] );\n\t\tdx7 = sx[ 2 ] - ( S6*sx[3] );\n\t\tdx8 = sx[ 1 ] - ( S7*sx[2] );\n\t\tdx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 9 ];\n\t\tdy1 = sy[ 8 ] - ( S0*sy[9] );\n\t\tdy2 = sy[ 7 ] - ( S1*sy[8] );\n\t\tdy3 = sy[ 6 ] - ( S2*sy[7] );\n\t\tdy4 = sy[ 5 ] - ( S3*sy[6] );\n\t\tdy5 = sy[ 4 ] - ( S4*sy[5] );\n\t\tdy6 = sy[ 3 ] - ( S5*sy[4] );\n\t\tdy7 = sy[ 2 ] - ( S6*sy[3] );\n\t\tdy8 = sy[ 1 ] - ( S7*sy[2] );\n\t\tdy9 = sy[ 0 ] - ( S8*sy[1] );\n\t} else { // order === 'column-major'\n\t\t// For column-major ndarrays, the first dimensions have the fastest changing indices...\n\t\tS0 = sh[ 0 ];\n\t\tS1 = sh[ 1 ];\n\t\tS2 = sh[ 2 ];\n\t\tS3 = sh[ 3 ];\n\t\tS4 = sh[ 4 ];\n\t\tS5 = sh[ 5 ];\n\t\tS6 = sh[ 6 ];\n\t\tS7 = sh[ 7 ];\n\t\tS8 = sh[ 8 ];\n\t\tS9 = sh[ 9 ];\n\t\tdx0 = sx[ 0 ]; // offset increment for innermost loop\n\t\tdx1 = sx[ 1 ] - ( S0*sx[0] );\n\t\tdx2 = sx[ 2 ] - ( S1*sx[1] );\n\t\tdx3 = sx[ 3 ] - ( S2*sx[2] );\n\t\tdx4 = sx[ 4 ] - ( S3*sx[3] );\n\t\tdx5 = sx[ 5 ] - ( S4*sx[4] );\n\t\tdx6 = sx[ 6 ] - ( S5*sx[5] );\n\t\tdx7 = sx[ 7 ] - ( S6*sx[6] );\n\t\tdx8 = sx[ 8 ] - ( S7*sx[7] );\n\t\tdx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop\n\t\tdy0 = sy[ 0 ];\n\t\tdy1 = sy[ 1 ] - ( S0*sy[0] );\n\t\tdy2 = sy[ 2 ] - ( S1*sy[1] );\n\t\tdy3 = sy[ 3 ] - ( S2*sy[2] );\n\t\tdy4 = sy[ 4 ] - ( S3*sy[3] );\n\t\tdy5 = sy[ 5 ] - ( S4*sy[4] );\n\t\tdy6 = sy[ 6 ] - ( S5*sy[5] );\n\t\tdy7 = sy[ 7 ] - ( S6*sy[6] );\n\t\tdy8 = sy[ 8 ] - ( S7*sy[7] );\n\t\tdy9 = sy[ 9 ] - ( S8*sy[8] );\n\t}\n\t// Set the pointers to the first indexed elements in the respective ndarrays...\n\tix = x.offset;\n\tiy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\t// Iterate over the ndarray dimensions...\n\tfor ( i9 = 0; i9 < S9; i9++ ) {\n\t\tfor ( i8 = 0; i8 < S8; i8++ ) {\n\t\t\tfor ( i7 = 0; i7 < S7; i7++ ) {\n\t\t\t\tfor ( i6 = 0; i6 < S6; i6++ ) {\n\t\t\t\t\tfor ( i5 = 0; i5 < S5; i5++ ) {\n\t\t\t\t\t\tfor ( i4 = 0; i4 < S4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < S3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < S2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < S1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < S0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) ); // eslint-disable-line max-len\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx6;\n\t\t\t\t\tiy += dy6;\n\t\t\t\t}\n\t\t\t\tix += dx7;\n\t\t\t\tiy += dy7;\n\t\t\t}\n\t\t\tix += dx8;\n\t\t\tiy += dy8;\n\t\t}\n\t\tix += dx9;\n\t\tiy += dy9;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default unary10d;\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 loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Float64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary2d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0 ]\n*/\nfunction blockedunary2d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar ox1;\n\tvar oy1;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar j0;\n\tvar j1;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\tif ( j1 < bsize ) {\n\t\t\ts1 = j1;\n\t\t\tj1 = 0;\n\t\t} else {\n\t\t\ts1 = bsize;\n\t\t\tj1 -= bsize;\n\t\t}\n\t\tox1 = ox + ( j1*sx[1] );\n\t\toy1 = oy + ( j1*sy[1] );\n\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\tif ( j0 < bsize ) {\n\t\t\t\ts0 = j0;\n\t\t\t\tj0 = 0;\n\t\t\t} else {\n\t\t\t\ts0 = bsize;\n\t\t\t\tj0 -= bsize;\n\t\t\t}\n\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t// Compute loop offset increments...\n\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t// Iterate over the ndarray dimensions...\n\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary2d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 1 ];\n* var sy = [ 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary3d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary3d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar ox1;\n\tvar ox2;\n\tvar oy1;\n\tvar oy2;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\tif ( j2 < bsize ) {\n\t\t\ts2 = j2;\n\t\t\tj2 = 0;\n\t\t} else {\n\t\t\ts2 = bsize;\n\t\t\tj2 -= bsize;\n\t\t}\n\t\tox2 = ox + ( j2*sx[2] );\n\t\toy2 = oy + ( j2*sy[2] );\n\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\tif ( j1 < bsize ) {\n\t\t\t\ts1 = j1;\n\t\t\t\tj1 = 0;\n\t\t\t} else {\n\t\t\t\ts1 = bsize;\n\t\t\t\tj1 -= bsize;\n\t\t\t}\n\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\ts0 = j0;\n\t\t\t\t\tj0 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts0 = bsize;\n\t\t\t\t\tj0 -= bsize;\n\t\t\t\t}\n\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t// Compute loop offset increments...\n\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary3d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 4, 4, 1 ];\n* var sy = [ 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary4d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary4d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\tif ( j3 < bsize ) {\n\t\t\ts3 = j3;\n\t\t\tj3 = 0;\n\t\t} else {\n\t\t\ts3 = bsize;\n\t\t\tj3 -= bsize;\n\t\t}\n\t\tox3 = ox + ( j3*sx[3] );\n\t\toy3 = oy + ( j3*sy[3] );\n\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\tif ( j2 < bsize ) {\n\t\t\t\ts2 = j2;\n\t\t\t\tj2 = 0;\n\t\t\t} else {\n\t\t\t\ts2 = bsize;\n\t\t\t\tj2 -= bsize;\n\t\t\t}\n\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\ts1 = j1;\n\t\t\t\t\tj1 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts1 = bsize;\n\t\t\t\t\tj1 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary4d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary5d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary5d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\tif ( j4 < bsize ) {\n\t\t\ts4 = j4;\n\t\t\tj4 = 0;\n\t\t} else {\n\t\t\ts4 = bsize;\n\t\t\tj4 -= bsize;\n\t\t}\n\t\tox4 = ox + ( j4*sx[4] );\n\t\toy4 = oy + ( j4*sy[4] );\n\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\tif ( j3 < bsize ) {\n\t\t\t\ts3 = j3;\n\t\t\t\tj3 = 0;\n\t\t\t} else {\n\t\t\t\ts3 = bsize;\n\t\t\t\tj3 -= bsize;\n\t\t\t}\n\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\ts2 = j2;\n\t\t\t\t\tj2 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts2 = bsize;\n\t\t\t\t\tj2 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary5d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary6d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary6d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\tif ( j5 < bsize ) {\n\t\t\ts5 = j5;\n\t\t\tj5 = 0;\n\t\t} else {\n\t\t\ts5 = bsize;\n\t\t\tj5 -= bsize;\n\t\t}\n\t\tox5 = ox + ( j5*sx[5] );\n\t\toy5 = oy + ( j5*sy[5] );\n\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\tif ( j4 < bsize ) {\n\t\t\t\ts4 = j4;\n\t\t\t\tj4 = 0;\n\t\t\t} else {\n\t\t\t\ts4 = bsize;\n\t\t\t\tj4 -= bsize;\n\t\t\t}\n\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\ts3 = j3;\n\t\t\t\t\tj3 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts3 = bsize;\n\t\t\t\t\tj3 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary6d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary7d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary7d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\tif ( j6 < bsize ) {\n\t\t\ts6 = j6;\n\t\t\tj6 = 0;\n\t\t} else {\n\t\t\ts6 = bsize;\n\t\t\tj6 -= bsize;\n\t\t}\n\t\tox6 = ox + ( j6*sx[6] );\n\t\toy6 = oy + ( j6*sy[6] );\n\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\tif ( j5 < bsize ) {\n\t\t\t\ts5 = j5;\n\t\t\t\tj5 = 0;\n\t\t\t} else {\n\t\t\t\ts5 = bsize;\n\t\t\t\tj5 -= bsize;\n\t\t\t}\n\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\ts4 = j4;\n\t\t\t\t\tj4 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts4 = bsize;\n\t\t\t\t\tj4 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary7d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary8d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary8d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\tif ( j7 < bsize ) {\n\t\t\ts7 = j7;\n\t\t\tj7 = 0;\n\t\t} else {\n\t\t\ts7 = bsize;\n\t\t\tj7 -= bsize;\n\t\t}\n\t\tox7 = ox + ( j7*sx[7] );\n\t\toy7 = oy + ( j7*sy[7] );\n\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\tif ( j6 < bsize ) {\n\t\t\t\ts6 = j6;\n\t\t\t\tj6 = 0;\n\t\t\t} else {\n\t\t\t\ts6 = bsize;\n\t\t\t\tj6 -= bsize;\n\t\t\t}\n\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\ts5 = j5;\n\t\t\t\t\tj5 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts5 = bsize;\n\t\t\t\t\tj5 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary8d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary9d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary9d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\tif ( j8 < bsize ) {\n\t\t\ts8 = j8;\n\t\t\tj8 = 0;\n\t\t} else {\n\t\t\ts8 = bsize;\n\t\t\tj8 -= bsize;\n\t\t}\n\t\tox8 = ox + ( j8*sx[8] );\n\t\toy8 = oy + ( j8*sy[8] );\n\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\tif ( j7 < bsize ) {\n\t\t\t\ts7 = j7;\n\t\t\t\tj7 = 0;\n\t\t\t} else {\n\t\t\t\ts7 = bsize;\n\t\t\t\tj7 -= bsize;\n\t\t\t}\n\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\ts6 = j6;\n\t\t\t\t\tj6 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts6 = bsize;\n\t\t\t\t\tj6 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary9d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Float64Array from '@stdlib/array-float64';\n*\n* function scale( x ) {\n* return x * 10.0;\n* }\n*\n* // Create data buffers:\n* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] );\n* var ybuf = new Float64Array( 6 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 12, 12, 12, 12, 12, 12, 12, 4, 4, 1 ];\n* var sy = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 1;\n* var oy = 0;\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'float64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major'\n* };\n* var y = {\n* 'dtype': 'float64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major'\n* };\n*\n* // Apply the unary function:\n* blockedunary10d( x, y, scale );\n*\n* console.log( y.data );\n* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ]\n*/\nfunction blockedunary10d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar ox9;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar oy9;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar s9;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar j9;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Iterate over blocks...\n\tfor ( j9 = sh[9]; j9 > 0; ) {\n\t\tif ( j9 < bsize ) {\n\t\t\ts9 = j9;\n\t\t\tj9 = 0;\n\t\t} else {\n\t\t\ts9 = bsize;\n\t\t\tj9 -= bsize;\n\t\t}\n\t\tox9 = ox + ( j9*sx[9] );\n\t\toy9 = oy + ( j9*sy[9] );\n\t\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\t\tif ( j8 < bsize ) {\n\t\t\t\ts8 = j8;\n\t\t\t\tj8 = 0;\n\t\t\t} else {\n\t\t\t\ts8 = bsize;\n\t\t\t\tj8 -= bsize;\n\t\t\t}\n\t\t\tdx9 = sx[9] - ( s8*sx[8] );\n\t\t\tdy9 = sy[9] - ( s8*sy[8] );\n\t\t\tox8 = ox9 + ( j8*sx[8] );\n\t\t\toy8 = oy9 + ( j8*sy[8] );\n\t\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\t\tif ( j7 < bsize ) {\n\t\t\t\t\ts7 = j7;\n\t\t\t\t\tj7 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts7 = bsize;\n\t\t\t\t\tj7 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\t\ts6 = j6;\n\t\t\t\t\t\tj6 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts6 = bsize;\n\t\t\t\t\t\tj6 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\t\tfor ( i9 = 0; i9 < s9; i9++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tybuf[ iy ] = fcn( xbuf[ ix ] );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx9;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy9;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary10d;\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 loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 2, 1 ];\n* var sy = [ 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary2d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary2d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dy0;\n\tvar dy1;\n\tvar ox1;\n\tvar oy1;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar j0;\n\tvar j1;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\tif ( j1 < bsize ) {\n\t\t\ts1 = j1;\n\t\t\tj1 = 0;\n\t\t} else {\n\t\t\ts1 = bsize;\n\t\t\tj1 -= bsize;\n\t\t}\n\t\tox1 = ox + ( j1*sx[1] );\n\t\toy1 = oy + ( j1*sy[1] );\n\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\tif ( j0 < bsize ) {\n\t\t\t\ts0 = j0;\n\t\t\t\tj0 = 0;\n\t\t\t} else {\n\t\t\t\ts0 = bsize;\n\t\t\t\tj0 -= bsize;\n\t\t\t}\n\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t// Compute loop offset increments...\n\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t// Iterate over the ndarray dimensions...\n\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\tix += dx0;\n\t\t\t\t\tiy += dy0;\n\t\t\t\t}\n\t\t\t\tix += dx1;\n\t\t\t\tiy += dy1;\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary2d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 2, 1 ];\n* var sy = [ 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary3d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary3d( x, y, fcn ) {\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar ox1;\n\tvar ox2;\n\tvar oy1;\n\tvar oy2;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\tif ( j2 < bsize ) {\n\t\t\ts2 = j2;\n\t\t\tj2 = 0;\n\t\t} else {\n\t\t\ts2 = bsize;\n\t\t\tj2 -= bsize;\n\t\t}\n\t\tox2 = ox + ( j2*sx[2] );\n\t\toy2 = oy + ( j2*sy[2] );\n\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\tif ( j1 < bsize ) {\n\t\t\t\ts1 = j1;\n\t\t\t\tj1 = 0;\n\t\t\t} else {\n\t\t\t\ts1 = bsize;\n\t\t\t\tj1 -= bsize;\n\t\t\t}\n\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\ts0 = j0;\n\t\t\t\t\tj0 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts0 = bsize;\n\t\t\t\t\tj0 -= bsize;\n\t\t\t\t}\n\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t// Compute loop offset increments...\n\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t}\n\t\t\t\t\tix += dx2;\n\t\t\t\t\tiy += dy2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary3d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary4d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary4d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\tif ( j3 < bsize ) {\n\t\t\ts3 = j3;\n\t\t\tj3 = 0;\n\t\t} else {\n\t\t\ts3 = bsize;\n\t\t\tj3 -= bsize;\n\t\t}\n\t\tox3 = ox + ( j3*sx[3] );\n\t\toy3 = oy + ( j3*sy[3] );\n\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\tif ( j2 < bsize ) {\n\t\t\t\ts2 = j2;\n\t\t\t\tj2 = 0;\n\t\t\t} else {\n\t\t\t\ts2 = bsize;\n\t\t\t\tj2 -= bsize;\n\t\t\t}\n\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\ts1 = j1;\n\t\t\t\t\tj1 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts1 = bsize;\n\t\t\t\t\tj1 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary4d;\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 max-depth */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary5d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary5d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\tif ( j4 < bsize ) {\n\t\t\ts4 = j4;\n\t\t\tj4 = 0;\n\t\t} else {\n\t\t\ts4 = bsize;\n\t\t\tj4 -= bsize;\n\t\t}\n\t\tox4 = ox + ( j4*sx[4] );\n\t\toy4 = oy + ( j4*sy[4] );\n\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\tif ( j3 < bsize ) {\n\t\t\t\ts3 = j3;\n\t\t\t\tj3 = 0;\n\t\t\t} else {\n\t\t\t\ts3 = bsize;\n\t\t\t\tj3 -= bsize;\n\t\t\t}\n\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\ts2 = j2;\n\t\t\t\t\tj2 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts2 = bsize;\n\t\t\t\t\tj2 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) ); // eslint-disable-line max-len\n\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary5d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary6d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary6d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\tif ( j5 < bsize ) {\n\t\t\ts5 = j5;\n\t\t\tj5 = 0;\n\t\t} else {\n\t\t\ts5 = bsize;\n\t\t\tj5 -= bsize;\n\t\t}\n\t\tox5 = ox + ( j5*sx[5] );\n\t\toy5 = oy + ( j5*sy[5] );\n\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\tif ( j4 < bsize ) {\n\t\t\t\ts4 = j4;\n\t\t\t\tj4 = 0;\n\t\t\t} else {\n\t\t\t\ts4 = bsize;\n\t\t\t\tj4 -= bsize;\n\t\t\t}\n\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\ts3 = j3;\n\t\t\t\t\tj3 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts3 = bsize;\n\t\t\t\t\tj3 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary6d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary7d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary7d( x, y, fcn ) { // eslint-disable-line max-statements\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\tif ( j6 < bsize ) {\n\t\t\ts6 = j6;\n\t\t\tj6 = 0;\n\t\t} else {\n\t\t\ts6 = bsize;\n\t\t\tj6 -= bsize;\n\t\t}\n\t\tox6 = ox + ( j6*sx[6] );\n\t\toy6 = oy + ( j6*sy[6] );\n\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\tif ( j5 < bsize ) {\n\t\t\t\ts5 = j5;\n\t\t\t\tj5 = 0;\n\t\t\t} else {\n\t\t\t\ts5 = bsize;\n\t\t\t\tj5 -= bsize;\n\t\t\t}\n\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\ts4 = j4;\n\t\t\t\t\tj4 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts4 = bsize;\n\t\t\t\t\tj4 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary7d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary8d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary8d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\tif ( j7 < bsize ) {\n\t\t\ts7 = j7;\n\t\t\tj7 = 0;\n\t\t} else {\n\t\t\ts7 = bsize;\n\t\t\tj7 -= bsize;\n\t\t}\n\t\tox7 = ox + ( j7*sx[7] );\n\t\toy7 = oy + ( j7*sy[7] );\n\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\tif ( j6 < bsize ) {\n\t\t\t\ts6 = j6;\n\t\t\t\tj6 = 0;\n\t\t\t} else {\n\t\t\t\ts6 = bsize;\n\t\t\t\tj6 -= bsize;\n\t\t\t}\n\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\ts5 = j5;\n\t\t\t\t\tj5 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts5 = bsize;\n\t\t\t\t\tj5 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary8d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary9d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary9d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\tif ( j8 < bsize ) {\n\t\t\ts8 = j8;\n\t\t\tj8 = 0;\n\t\t} else {\n\t\t\ts8 = bsize;\n\t\t\tj8 -= bsize;\n\t\t}\n\t\tox8 = ox + ( j8*sx[8] );\n\t\toy8 = oy + ( j8*sy[8] );\n\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\tif ( j7 < bsize ) {\n\t\t\t\ts7 = j7;\n\t\t\t\tj7 = 0;\n\t\t\t} else {\n\t\t\t\ts7 = bsize;\n\t\t\t\tj7 -= bsize;\n\t\t\t}\n\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\ts6 = j6;\n\t\t\t\t\tj6 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts6 = bsize;\n\t\t\t\t\tj6 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary9d;\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 max-depth, max-len */\n\n'use strict';\n\n// MODULES //\n\nimport loopOrder from '@stdlib/ndarray-base-unary-loop-interchange-order';\nimport blockSize from '@stdlib/ndarray-base-unary-tiling-block-size';\n\n\n// MAIN //\n\n/**\n* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking.\n*\n* @private\n* @param {Object} x - object containing input ndarray meta data\n* @param {string} x.dtype - data type\n* @param {Collection} x.data - data buffer\n* @param {NonNegativeIntegerArray} x.shape - dimensions\n* @param {IntegerArray} x.strides - stride lengths\n* @param {NonNegativeInteger} x.offset - index offset\n* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} x.accessors - data buffer accessors\n* @param {Object} y - object containing output ndarray meta data\n* @param {string} y.dtype - data type\n* @param {Collection} y.data - data buffer\n* @param {NonNegativeIntegerArray} y.shape - dimensions\n* @param {IntegerArray} y.strides - stride lengths\n* @param {NonNegativeInteger} y.offset - index offset\n* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style)\n* @param {Array} y.accessors - data buffer accessors\n* @param {Callback} fcn - unary callback\n*\n* @example\n* import Complex64Array from '@stdlib/array-complex64';\n* import Complex64 from '@stdlib/complex-float32-ctor';\n* import realf from '@stdlib/complex-float32-real';\n* import imagf from '@stdlib/complex-float32-imag';\n*\n* function scale( z ) {\n* return new Complex64( realf(z)*10.0, imagf(z)*10.0 );\n* }\n*\n* // Create data buffers:\n* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );\n* var ybuf = new Complex64Array( 4 );\n*\n* // Define the shape of the input and output arrays:\n* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ];\n*\n* // Define the array strides:\n* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n* var sy = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ];\n*\n* // Define the index offsets:\n* var ox = 0;\n* var oy = 0;\n*\n* // Define getters and setters:\n* function getter( buf, idx ) {\n* return buf.get( idx );\n* }\n*\n* function setter( buf, idx, value ) {\n* buf.set( value, idx );\n* }\n*\n* // Create the input and output ndarray-like objects:\n* var x = {\n* 'dtype': 'complex64',\n* 'data': xbuf,\n* 'shape': shape,\n* 'strides': sx,\n* 'offset': ox,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n* var y = {\n* 'dtype': 'complex64',\n* 'data': ybuf,\n* 'shape': shape,\n* 'strides': sy,\n* 'offset': oy,\n* 'order': 'row-major',\n* 'accessors': [ getter, setter ]\n* };\n*\n* // Apply the unary function:\n* blockedunary10d( x, y, scale );\n*\n* var v = y.data.get( 0 );\n*\n* var re = realf( v );\n* // returns 10.0\n*\n* var im = imagf( v );\n* // returns 20.0\n*/\nfunction blockedunary10d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function\n\tvar bsize;\n\tvar xbuf;\n\tvar ybuf;\n\tvar get;\n\tvar set;\n\tvar dx0;\n\tvar dx1;\n\tvar dx2;\n\tvar dx3;\n\tvar dx4;\n\tvar dx5;\n\tvar dx6;\n\tvar dx7;\n\tvar dx8;\n\tvar dx9;\n\tvar dy0;\n\tvar dy1;\n\tvar dy2;\n\tvar dy3;\n\tvar dy4;\n\tvar dy5;\n\tvar dy6;\n\tvar dy7;\n\tvar dy8;\n\tvar dy9;\n\tvar ox1;\n\tvar ox2;\n\tvar ox3;\n\tvar ox4;\n\tvar ox5;\n\tvar ox6;\n\tvar ox7;\n\tvar ox8;\n\tvar ox9;\n\tvar oy1;\n\tvar oy2;\n\tvar oy3;\n\tvar oy4;\n\tvar oy5;\n\tvar oy6;\n\tvar oy7;\n\tvar oy8;\n\tvar oy9;\n\tvar sh;\n\tvar s0;\n\tvar s1;\n\tvar s2;\n\tvar s3;\n\tvar s4;\n\tvar s5;\n\tvar s6;\n\tvar s7;\n\tvar s8;\n\tvar s9;\n\tvar sx;\n\tvar sy;\n\tvar ox;\n\tvar oy;\n\tvar ix;\n\tvar iy;\n\tvar i0;\n\tvar i1;\n\tvar i2;\n\tvar i3;\n\tvar i4;\n\tvar i5;\n\tvar i6;\n\tvar i7;\n\tvar i8;\n\tvar i9;\n\tvar j0;\n\tvar j1;\n\tvar j2;\n\tvar j3;\n\tvar j4;\n\tvar j5;\n\tvar j6;\n\tvar j7;\n\tvar j8;\n\tvar j9;\n\tvar o;\n\n\t// Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop...\n\n\t// Resolve the loop interchange order:\n\to = loopOrder( x.shape, x.strides, y.strides );\n\tsh = o.sh;\n\tsx = o.sx;\n\tsy = o.sy;\n\n\t// Determine the block size:\n\tbsize = blockSize( x.dtype, y.dtype );\n\n\t// Cache the indices of the first indexed elements in the respective ndarrays...\n\tox = x.offset;\n\toy = y.offset;\n\n\t// Cache references to the input and output ndarray buffers...\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache offset increments for the innermost loop...\n\tdx0 = sx[0];\n\tdy0 = sy[0];\n\n\t// Cache accessors:\n\tget = x.accessors[0];\n\tset = y.accessors[1];\n\n\t// Iterate over blocks...\n\tfor ( j9 = sh[9]; j9 > 0; ) {\n\t\tif ( j9 < bsize ) {\n\t\t\ts9 = j9;\n\t\t\tj9 = 0;\n\t\t} else {\n\t\t\ts9 = bsize;\n\t\t\tj9 -= bsize;\n\t\t}\n\t\tox9 = ox + ( j9*sx[9] );\n\t\toy9 = oy + ( j9*sy[9] );\n\t\tfor ( j8 = sh[8]; j8 > 0; ) {\n\t\t\tif ( j8 < bsize ) {\n\t\t\t\ts8 = j8;\n\t\t\t\tj8 = 0;\n\t\t\t} else {\n\t\t\t\ts8 = bsize;\n\t\t\t\tj8 -= bsize;\n\t\t\t}\n\t\t\tdx9 = sx[9] - ( s8*sx[8] );\n\t\t\tdy9 = sy[9] - ( s8*sy[8] );\n\t\t\tox8 = ox9 + ( j8*sx[8] );\n\t\t\toy8 = oy9 + ( j8*sy[8] );\n\t\t\tfor ( j7 = sh[7]; j7 > 0; ) {\n\t\t\t\tif ( j7 < bsize ) {\n\t\t\t\t\ts7 = j7;\n\t\t\t\t\tj7 = 0;\n\t\t\t\t} else {\n\t\t\t\t\ts7 = bsize;\n\t\t\t\t\tj7 -= bsize;\n\t\t\t\t}\n\t\t\t\tdx8 = sx[8] - ( s7*sx[7] );\n\t\t\t\tdy8 = sy[8] - ( s7*sy[7] );\n\t\t\t\tox7 = ox8 + ( j7*sx[7] );\n\t\t\t\toy7 = oy8 + ( j7*sy[7] );\n\t\t\t\tfor ( j6 = sh[6]; j6 > 0; ) {\n\t\t\t\t\tif ( j6 < bsize ) {\n\t\t\t\t\t\ts6 = j6;\n\t\t\t\t\t\tj6 = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ts6 = bsize;\n\t\t\t\t\t\tj6 -= bsize;\n\t\t\t\t\t}\n\t\t\t\t\tdx7 = sx[7] - ( s6*sx[6] );\n\t\t\t\t\tdy7 = sy[7] - ( s6*sy[6] );\n\t\t\t\t\tox6 = ox7 + ( j6*sx[6] );\n\t\t\t\t\toy6 = oy7 + ( j6*sy[6] );\n\t\t\t\t\tfor ( j5 = sh[5]; j5 > 0; ) {\n\t\t\t\t\t\tif ( j5 < bsize ) {\n\t\t\t\t\t\t\ts5 = j5;\n\t\t\t\t\t\t\tj5 = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ts5 = bsize;\n\t\t\t\t\t\t\tj5 -= bsize;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdx6 = sx[6] - ( s5*sx[5] );\n\t\t\t\t\t\tdy6 = sy[6] - ( s5*sy[5] );\n\t\t\t\t\t\tox5 = ox6 + ( j5*sx[5] );\n\t\t\t\t\t\toy5 = oy6 + ( j5*sy[5] );\n\t\t\t\t\t\tfor ( j4 = sh[4]; j4 > 0; ) {\n\t\t\t\t\t\t\tif ( j4 < bsize ) {\n\t\t\t\t\t\t\t\ts4 = j4;\n\t\t\t\t\t\t\t\tj4 = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ts4 = bsize;\n\t\t\t\t\t\t\t\tj4 -= bsize;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdx5 = sx[5] - ( s4*sx[4] );\n\t\t\t\t\t\t\tdy5 = sy[5] - ( s4*sy[4] );\n\t\t\t\t\t\t\tox4 = ox5 + ( j4*sx[4] );\n\t\t\t\t\t\t\toy4 = oy5 + ( j4*sy[4] );\n\t\t\t\t\t\t\tfor ( j3 = sh[3]; j3 > 0; ) {\n\t\t\t\t\t\t\t\tif ( j3 < bsize ) {\n\t\t\t\t\t\t\t\t\ts3 = j3;\n\t\t\t\t\t\t\t\t\tj3 = 0;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ts3 = bsize;\n\t\t\t\t\t\t\t\t\tj3 -= bsize;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdx4 = sx[4] - ( s3*sx[3] );\n\t\t\t\t\t\t\t\tdy4 = sy[4] - ( s3*sy[3] );\n\t\t\t\t\t\t\t\tox3 = ox4 + ( j3*sx[3] );\n\t\t\t\t\t\t\t\toy3 = oy4 + ( j3*sy[3] );\n\t\t\t\t\t\t\t\tfor ( j2 = sh[2]; j2 > 0; ) {\n\t\t\t\t\t\t\t\t\tif ( j2 < bsize ) {\n\t\t\t\t\t\t\t\t\t\ts2 = j2;\n\t\t\t\t\t\t\t\t\t\tj2 = 0;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\ts2 = bsize;\n\t\t\t\t\t\t\t\t\t\tj2 -= bsize;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdx3 = sx[3] - ( s2*sx[2] );\n\t\t\t\t\t\t\t\t\tdy3 = sy[3] - ( s2*sy[2] );\n\t\t\t\t\t\t\t\t\tox2 = ox3 + ( j2*sx[2] );\n\t\t\t\t\t\t\t\t\toy2 = oy3 + ( j2*sy[2] );\n\t\t\t\t\t\t\t\t\tfor ( j1 = sh[1]; j1 > 0; ) {\n\t\t\t\t\t\t\t\t\t\tif ( j1 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\ts1 = j1;\n\t\t\t\t\t\t\t\t\t\t\tj1 = 0;\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\ts1 = bsize;\n\t\t\t\t\t\t\t\t\t\t\tj1 -= bsize;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdx2 = sx[2] - ( s1*sx[1] );\n\t\t\t\t\t\t\t\t\t\tdy2 = sy[2] - ( s1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tox1 = ox2 + ( j1*sx[1] );\n\t\t\t\t\t\t\t\t\t\toy1 = oy2 + ( j1*sy[1] );\n\t\t\t\t\t\t\t\t\t\tfor ( j0 = sh[0]; j0 > 0; ) {\n\t\t\t\t\t\t\t\t\t\t\tif ( j0 < bsize ) {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = j0;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 = 0;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\ts0 = bsize;\n\t\t\t\t\t\t\t\t\t\t\t\tj0 -= bsize;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t// Compute index offsets for the first input and output ndarray elements in the current block...\n\t\t\t\t\t\t\t\t\t\t\tix = ox1 + ( j0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tiy = oy1 + ( j0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Compute loop offset increments...\n\t\t\t\t\t\t\t\t\t\t\tdx1 = sx[1] - ( s0*sx[0] );\n\t\t\t\t\t\t\t\t\t\t\tdy1 = sy[1] - ( s0*sy[0] );\n\n\t\t\t\t\t\t\t\t\t\t\t// Iterate over the ndarray dimensions...\n\t\t\t\t\t\t\t\t\t\t\tfor ( i9 = 0; i9 < s9; i9++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\tfor ( i8 = 0; i8 < s8; i8++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i7 = 0; i7 < s7; i7++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i6 = 0; i6 < s6; i6++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i5 = 0; i5 < s5; i5++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i4 = 0; i4 < s4; i4++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i3 = 0; i3 < s3; i3++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i2 = 0; i2 < s2; i2++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i1 = 0; i1 < s1; i1++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor ( i0 = 0; i0 < s0; i0++ ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tset( ybuf, iy, fcn( get( xbuf, ix ) ) );\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy0;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy1;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy2;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy3;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy4;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy5;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy6;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy7;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\tix += dx8;\n\t\t\t\t\t\t\t\t\t\t\t\t\tiy += dy8;\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tix += dx9;\n\t\t\t\t\t\t\t\t\t\t\t\tiy += dy9;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default blockedunary10d;\n"],"names":["MODE","UNARY","x","y","fcn","data","offset","xbuf","ybuf","dx0","dy0","S0","ix","iy","i0","shape","strides","isRowMajor","dx1","dy1","sh","S1","sx","sy","i1","dx2","dy2","S2","i2","dx3","dy3","S3","i3","dx4","dy4","S4","i4","dx5","dy5","S5","i5","dx6","dy6","S6","i6","dx7","dy7","S7","i7","dx8","dy8","S8","i8","dx9","dy9","S9","i9","ACCESSOR_UNARY","accessors","get","set","BLOCKED_UNARY","bsize","ox1","oy1","s0","s1","ox","oy","j0","j1","o","loopOrder","blockSize","dtype","ox2","oy2","s2","j2","ox3","oy3","s3","j3","ox4","oy4","s4","j4","ox5","oy5","s5","j5","ox6","oy6","s6","j6","ox7","oy7","s7","j7","ox8","oy8","s8","j8","ox9","oy9","s9","j9","BLOCKED_ACCESSOR_UNARY","MAX_DIMS","length","unary","arrays","ndims","xmmv","ymmv","shx","shy","iox","ioy","len","ord","ns","d","i","ndarray2object","Error","format","accessorProtocol","iterationOrder","strides2order","minmaxViewBufferIndex","ordx","ordy","numel","order","vind2bind","accessorunarynd","unarynd"],"mappings":";;w6BA4BA,IAAIA,EAAO,QCAX,IAAIA,EAAO,QC6CX,IAAIC,EAAQ,CCgBZ,SAAkBC,EAAGC,EAAGC,GACvBD,EAAEE,KAAMF,EAAEG,QAAWF,EAAKF,EAAEG,KAAMH,EAAEI,QACrC,ECFA,SAAkBJ,EAAGC,EAAGC,GACvB,IAAIG,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EAkBJ,IAbAH,EAAKT,EAAEa,MAAO,GACdN,EAAMP,EAAEc,QAAS,GACjBN,EAAMP,EAAEa,QAAS,GAGjBJ,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGHS,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,CAER,EC9BA,SAAkBR,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAR,EACAS,EACAC,EACAT,EACAU,EACAC,EACAC,EACAX,EACAC,EACAC,EACAU,EAkCJ,IA7BAJ,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGHmB,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACF,EC1DA,SAAkBjB,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAf,EACAS,EACAO,EACAN,EACAT,EACAU,EACAM,EACAL,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EAwCJ,IAnCAR,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGHuB,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACF,ECxEA,SAAkBxB,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAnB,EACAS,EACAO,EACAI,EACAV,EACAT,EACAU,EACAM,EACAI,EACAT,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EA8CJ,IAzCAZ,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGH2B,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACF,ECtFA,SAAkB5B,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAvB,EACAS,EACAO,EACAI,EACAI,EACAd,EACAT,EACAU,EACAM,EACAI,EACAI,EACAb,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EAoDJ,IA/CAhB,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGH+B,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACF,EClGA,SAAkBhC,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACA3B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAlB,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAjB,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EA0DJ,IArDApB,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGHmC,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACF,EClHA,SAAkBpC,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACA/B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAtB,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACArB,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EAgEJ,IA3DAxB,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGHuC,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACF,EChIA,SAAkBxC,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAnC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACA1B,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACAI,EACAzB,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EAsEJ,IAjEA5B,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGH2C,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CACF,EC9IA,SAAkB5C,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAvC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA9B,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA7B,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EA4EJ,IAvEAhC,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGH+C,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CACDlC,GAAMqC,EACNpC,GAAMqC,CACN,CACF,EC5JA,SAAmBhD,EAAGC,EAAGc,EAAYb,GACpC,IAAIG,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA3C,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAlC,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAjC,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EAkFJ,IA7EApC,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTmC,EAAKnC,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ6B,EAAG7B,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ4B,EAAG5B,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTmC,EAAKnC,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ6B,EAAG7B,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ4B,EAAG5B,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGHmD,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CACDlC,GAAMqC,EACNpC,GAAMqC,CACN,CACDtC,GAAMyC,EACNxC,GAAMyC,CACN,CACF,GXhLIG,EAAiB,CYwBrB,SAAkBvD,EAAGC,EAAGC,GACvBD,EAAEuD,UAAW,GAAKvD,EAAEE,KAAMF,EAAEG,OAAQF,EAAKF,EAAEwD,UAAW,GAAKxD,EAAEG,KAAMH,EAAEI,SACtE,ECFA,SAAkBJ,EAAGC,EAAGC,GACvB,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAC,EACAC,EACAC,EACAC,EACAC,EAsBJ,IAjBAH,EAAKT,EAAEa,MAAO,GACdN,EAAMP,EAAEc,QAAS,GACjBN,EAAMP,EAAEa,QAAS,GAGjBJ,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGb5C,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,CAER,ECpCA,SAAkBR,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAR,EACAS,EACAC,EACAT,EACAU,EACAC,EACAC,EACAX,EACAC,EACAC,EACAU,EAsCJ,IAjCAJ,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGblC,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACF,EChEA,SAAkBjB,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAf,EACAS,EACAO,EACAN,EACAT,EACAU,EACAM,EACAL,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EA4CJ,IAvCAR,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGb9B,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACF,EC9EA,SAAkBxB,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAnB,EACAS,EACAO,EACAI,EACAV,EACAT,EACAU,EACAM,EACAI,EACAT,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EAkDJ,IA7CAZ,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGb1B,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACF,EC5FA,SAAkB5B,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAvB,EACAS,EACAO,EACAI,EACAI,EACAd,EACAT,EACAU,EACAM,EACAI,EACAI,EACAb,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EAwDJ,IAnDAhB,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGbtB,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACF,ECxGA,SAAkBhC,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACA3B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAlB,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAjB,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EA8DJ,IAzDApB,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGblB,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACF,ECxHA,SAAkBpC,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACA/B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAtB,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACArB,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EAoEJ,IA/DAxB,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGbd,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACF,ECtIA,SAAkBxC,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAnC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACA1B,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACAI,EACAzB,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EA0EJ,IArEA5B,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGbV,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CACF,ECpJA,SAAkB5C,EAAGC,EAAGc,EAAYb,GACnC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAvC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA9B,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA7B,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EAgFJ,IA3EAhC,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGbN,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CACDlC,GAAMqC,EACNpC,GAAMqC,CACN,CACF,EClKA,SAAmBhD,EAAGC,EAAGc,EAAYb,GACpC,IAAIG,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA3C,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAlC,EACAT,EACAU,EACAM,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAjC,EACAC,EACAX,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EAsFJ,IAjFApC,EAAKlB,EAAEa,MACPO,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QACFC,GAEJN,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTmC,EAAKnC,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ6B,EAAG7B,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ4B,EAAG5B,EAAG,KAGxBZ,EAAKS,EAAI,GACTC,EAAKD,EAAI,GACTO,EAAKP,EAAI,GACTW,EAAKX,EAAI,GACTe,EAAKf,EAAI,GACTmB,EAAKnB,EAAI,GACTuB,EAAKvB,EAAI,GACT2B,EAAK3B,EAAI,GACT+B,EAAK/B,EAAI,GACTmC,EAAKnC,EAAI,GACTX,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQX,EAAGW,EAAG,GACxBG,EAAMH,EAAI,GAAQD,EAAGC,EAAG,GACxBO,EAAMP,EAAI,GAAQK,EAAGL,EAAG,GACxBW,EAAMX,EAAI,GAAQS,EAAGT,EAAG,GACxBe,EAAMf,EAAI,GAAQa,EAAGb,EAAG,GACxBmB,EAAMnB,EAAI,GAAQiB,EAAGjB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQqB,EAAGrB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQyB,EAAGzB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ6B,EAAG7B,EAAG,GACxBZ,EAAMa,EAAI,GACVJ,EAAMI,EAAI,GAAQZ,EAAGY,EAAG,GACxBG,EAAMH,EAAI,GAAQF,EAAGE,EAAG,GACxBO,EAAMP,EAAI,GAAQI,EAAGJ,EAAG,GACxBW,EAAMX,EAAI,GAAQQ,EAAGR,EAAG,GACxBe,EAAMf,EAAI,GAAQY,EAAGZ,EAAG,GACxBmB,EAAMnB,EAAI,GAAQgB,EAAGhB,EAAG,GACxBuB,EAAMvB,EAAI,GAAQoB,EAAGpB,EAAG,GACxB2B,EAAM3B,EAAI,GAAQwB,EAAGxB,EAAG,GACxB+B,EAAM/B,EAAI,GAAQ4B,EAAG5B,EAAG,IAGzBX,EAAKV,EAAEI,OACPO,EAAKV,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTsD,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGbF,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKD,EAAIC,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKH,EAAIG,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKH,EAAIG,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CACDlC,GAAMqC,EACNpC,GAAMqC,CACN,CACDtC,GAAMyC,EACNxC,GAAMyC,CACN,CACF,GtB9LIO,EAAgB,CuBLpB,SAAyB3D,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAR,EACAS,EACA4C,EACAC,EACA5C,EACA6C,EACAC,EACA5C,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACA6C,EACAC,EACAC,EA0BJ,IApBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGH+C,EAAKlD,EAAG,GAAIkD,EAAK,GAUtB,IATKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPC,EAAMI,EAAOG,EAAGhD,EAAG,GACnB0C,EAAMI,EAAOE,EAAG/C,EAAG,GACb8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBC,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CAGJ,ECrFA,SAAyBjB,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAf,EACAS,EACAO,EACAqC,EACAY,EACAX,EACAY,EACAxD,EACA6C,EACAC,EACAW,EACAvD,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAyC,EACAC,EACAQ,EACAP,EA0BJ,IApBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGHuD,EAAK1D,EAAG,GAAI0D,EAAK,GAUtB,IATKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPa,EAAMR,EAAOW,EAAGxD,EAAG,GACnBsD,EAAMR,EAAOU,EAAGvD,EAAG,GACb+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBK,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CAIL,EC/GA,SAAyBxB,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAnB,EACAS,EACAO,EACAI,EACAiC,EACAY,EACAI,EACAf,EACAY,EACAI,EACA5D,EACA6C,EACAC,EACAW,EACAI,EACA3D,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAqC,EACAC,EACAQ,EACAI,EACAX,EA0BJ,IApBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGH2D,EAAK9D,EAAG,GAAI8D,EAAK,GAUtB,IATKA,EAAKpB,GACTmB,EAAKC,EACLA,EAAK,IAELD,EAAKnB,EACLoB,GAAMpB,GAEPiB,EAAMZ,EAAOe,EAAG5D,EAAG,GACnB0D,EAAMZ,EAAOc,EAAG3D,EAAG,GACbuD,EAAK1D,EAAG,GAAI0D,EAAK,GAYtB,IAXKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,EAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,EAAGvD,EAAG,GACd+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBS,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CAKN,ECvIA,SAAyB5B,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAvB,EACAS,EACAO,EACAI,EACAI,EACA6B,EACAY,EACAI,EACAI,EACAnB,EACAY,EACAI,EACAI,EACAhE,EACA6C,EACAC,EACAW,EACAI,EACAI,EACA/D,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAiC,EACAC,EACAQ,EACAI,EACAI,EACAf,EA0BJ,IApBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGH+D,EAAKlE,EAAG,GAAIkE,EAAK,GAUtB,IATKA,EAAKxB,GACTuB,EAAKC,EACLA,EAAK,IAELD,EAAKvB,EACLwB,GAAMxB,GAEPqB,EAAMhB,EAAOmB,EAAGhE,EAAG,GACnB8D,EAAMhB,EAAOkB,EAAG/D,EAAG,GACb2D,EAAK9D,EAAG,GAAI8D,EAAK,GAYtB,IAXKA,EAAKpB,GACTmB,EAAKC,EACLA,EAAK,IAELD,EAAKnB,EACLoB,GAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,EAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,EAAG3D,EAAG,GACduD,EAAK1D,EAAG,GAAI0D,EAAK,GAYtB,IAXKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,EAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,EAAGvD,EAAG,GACd+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBa,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CAMP,EC/JA,SAAyBhC,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACA3B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAyB,EACAY,EACAI,EACAI,EACAI,EACAvB,EACAY,EACAI,EACAI,EACAI,EACApE,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAnE,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACA6B,EACAC,EACAQ,EACAI,EACAI,EACAI,GACAnB,GA0BJ,IApBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGHmE,GAAKtE,EAAG,GAAIsE,GAAK,GAUtB,IATKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPyB,EAAMpB,EAAOuB,GAAGpE,EAAG,GACnBkE,EAAMpB,EAAOsB,GAAGnE,EAAG,GACb+D,EAAKlE,EAAG,GAAIkE,EAAK,GAYtB,IAXKA,EAAKxB,GACTuB,EAAKC,EACLA,EAAK,IAELD,EAAKvB,EACLwB,GAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,EAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,EAAG/D,EAAG,GACd2D,EAAK9D,EAAG,GAAI8D,EAAK,GAYtB,IAXKA,EAAKpB,GACTmB,EAAKC,EACLA,EAAK,IAELD,EAAKnB,EACLoB,GAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,EAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,EAAG3D,EAAG,GACduD,EAAK1D,EAAG,GAAI0D,EAAK,GAYtB,IAXKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,EAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,EAAGvD,EAAG,GACd+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBiB,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CAOR,ECvLA,SAAyBpC,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACA/B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAqB,EACAY,EACAI,EACAI,EACAI,EACAI,EACA3B,EACAY,EACAI,EACAI,EACAI,EACAI,EACAxE,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAvE,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACAI,GACAyB,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAvB,GA0BJ,IApBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGHuE,GAAK1E,EAAG,GAAI0E,GAAK,GAUtB,IATKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEP6B,EAAMxB,EAAO2B,GAAGxE,EAAG,GACnBsE,EAAMxB,EAAO0B,GAAGvE,EAAG,GACbmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,EAAG,GAAOmE,EAAGnE,EAAG,GACtBoB,EAAMnB,EAAG,GAAOkE,EAAGlE,EAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,EAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,EAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,EAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,EAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,EAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,EAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,EAAKmD,EAAQM,GAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,GAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBqB,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CAQT,EC/MA,SAAyBxC,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAnC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAiB,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACA/B,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACA5E,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAI,EACA3E,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAqB,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAI,GACA3B,GA0BJ,IApBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGH2E,GAAK9E,EAAG,GAAI8E,GAAK,GAUtB,IATKA,GAAKpC,GACTmC,EAAKC,GACLA,GAAK,IAELD,EAAKnC,EACLoC,IAAMpC,GAEPiC,EAAM5B,EAAO+B,GAAG5E,EAAG,GACnB0E,EAAM5B,EAAO8B,GAAG3E,EAAG,GACbuE,GAAK1E,EAAG,GAAI0E,GAAK,GAYtB,IAXKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEPjB,EAAMvB,EAAG,GAAOuE,EAAGvE,EAAG,GACtBwB,EAAMvB,EAAG,GAAOsE,EAAGtE,EAAG,GACtBoE,EAAMI,EAAQD,GAAGxE,EAAG,GACpBsE,EAAMI,EAAQF,GAAGvE,EAAG,GACdmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,EAAG,GAAOmE,EAAGnE,EAAG,GACtBoB,EAAMnB,EAAG,GAAOkE,EAAGlE,EAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,EAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,EAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,EAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,EAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,EAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,EAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,EAAKmD,EAAQM,GAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,GAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhByB,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAK0C,EAAI1C,KAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtBN,EAAMK,GAAOT,EAAKG,EAAMK,IACxBA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CACD9B,GAAMiC,EACNhC,GAAMiC,CACN,CASV,ECvOA,SAAyB5C,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAvC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAa,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAnC,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAhF,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA/E,EACAC,EACA4C,GACAC,GACAxD,GACAC,GACAC,GACAU,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAiB,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACA/B,GA0BJ,IApBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,GAAKjE,EAAEI,OACP8D,GAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGH+E,GAAKlF,EAAG,GAAIkF,GAAK,GAUtB,IATKA,GAAKxC,GACTuC,EAAKC,GACLA,GAAK,IAELD,EAAKvC,EACLwC,IAAMxC,GAEPqC,EAAMhC,GAAOmC,GAAGhF,EAAG,GACnB8E,EAAMhC,GAAOkC,GAAG/E,EAAG,GACb2E,GAAK9E,EAAG,GAAI8E,GAAK,GAYtB,IAXKA,GAAKpC,GACTmC,EAAKC,GACLA,GAAK,IAELD,EAAKnC,EACLoC,IAAMpC,GAEPb,EAAM3B,EAAG,GAAO2E,EAAG3E,EAAG,GACtB4B,EAAM3B,EAAG,GAAO0E,EAAG1E,EAAG,GACtBwE,EAAMI,EAAQD,GAAG5E,EAAG,GACpB0E,EAAMI,EAAQF,GAAG3E,EAAG,GACduE,GAAK1E,EAAG,GAAI0E,GAAK,GAYtB,IAXKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEPjB,EAAMvB,EAAG,GAAOuE,EAAGvE,EAAG,GACtBwB,EAAMvB,EAAG,GAAOsE,EAAGtE,EAAG,GACtBoE,EAAMI,EAAQD,GAAGxE,EAAG,GACpBsE,EAAMI,EAAQF,GAAGvE,EAAG,GACdmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,EAAG,GAAOmE,EAAGnE,EAAG,GACtBoB,EAAMnB,EAAG,GAAOkE,EAAGlE,EAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,EAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,EAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,EAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,EAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,EAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,EAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,GAAKmD,EAAQM,GAAG/C,EAAG,GACnBT,GAAKmD,EAAQK,GAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhB6B,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAK0C,EAAI1C,KAAO,CAC7B,IAAMV,GAAK,EAAGA,GAAKmD,EAAInD,KACtBN,EAAMK,IAAOT,EAAKG,EAAMK,KACxBA,IAAMH,EACNI,IAAMH,EAEPE,IAAMM,EACNL,IAAMM,CACN,CACDP,IAAMa,EACNZ,IAAMa,CACN,CACDd,IAAMiB,EACNhB,IAAMiB,CACN,CACDlB,IAAMqB,EACNpB,IAAMqB,CACN,CACDtB,IAAMyB,EACNxB,IAAMyB,CACN,CACD1B,IAAM6B,EACN5B,IAAM6B,CACN,CACD9B,IAAMiC,EACNhC,IAAMiC,CACN,CACDlC,IAAMqC,EACNpC,IAAMqC,CACN,CAUX,EC/PA,SAA0BhD,EAAGC,EAAGC,GAC/B,IAAI0D,EACAvD,EACAC,EACAC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA3C,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAS,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAvC,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACApF,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAI,GACAI,GACAI,GACAnF,GACAC,GACA4C,GACAC,GACAxD,GACAC,GACAC,GACAU,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAa,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAnC,GA0BJ,IApBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,GAAKiD,GAAEjD,GACPC,GAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,GAAKjE,EAAEI,OACP8D,GAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,GAAG,GACTZ,EAAMa,GAAG,GAGHmF,GAAKtF,EAAG,GAAIsF,GAAK,GAUtB,IATKA,GAAK5C,GACT2C,GAAKC,GACLA,GAAK,IAELD,GAAK3C,EACL4C,IAAM5C,GAEPyC,EAAMpC,GAAOuC,GAAGpF,GAAG,GACnBkF,EAAMpC,GAAOsC,GAAGnF,GAAG,GACb+E,GAAKlF,EAAG,GAAIkF,GAAK,GAYtB,IAXKA,GAAKxC,GACTuC,GAAKC,GACLA,GAAK,IAELD,GAAKvC,EACLwC,IAAMxC,GAEPT,EAAM/B,GAAG,GAAO+E,GAAG/E,GAAG,GACtBgC,EAAM/B,GAAG,GAAO8E,GAAG9E,GAAG,GACtB4E,EAAMI,EAAQD,GAAGhF,GAAG,GACpB8E,EAAMI,EAAQF,GAAG/E,GAAG,GACd2E,GAAK9E,EAAG,GAAI8E,GAAK,GAYtB,IAXKA,GAAKpC,GACTmC,GAAKC,GACLA,GAAK,IAELD,GAAKnC,EACLoC,IAAMpC,GAEPb,EAAM3B,GAAG,GAAO2E,GAAG3E,GAAG,GACtB4B,EAAM3B,GAAG,GAAO0E,GAAG1E,GAAG,GACtBwE,EAAMI,EAAQD,GAAG5E,GAAG,GACpB0E,EAAMI,EAAQF,GAAG3E,GAAG,GACduE,GAAK1E,EAAG,GAAI0E,GAAK,GAYtB,IAXKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEPjB,EAAMvB,GAAG,GAAOuE,EAAGvE,GAAG,GACtBwB,EAAMvB,GAAG,GAAOsE,EAAGtE,GAAG,GACtBoE,EAAMI,EAAQD,GAAGxE,GAAG,GACpBsE,EAAMI,EAAQF,GAAGvE,GAAG,GACdmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,GAAG,GAAOmE,EAAGnE,GAAG,GACtBoB,EAAMnB,GAAG,GAAOkE,EAAGlE,GAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,GAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,GAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,GAAG,GAAO+D,EAAG/D,GAAG,GACtBgB,EAAMf,GAAG,GAAO8D,EAAG9D,GAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,GAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,GAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,GAAG,GAAO2D,EAAG3D,GAAG,GACtBY,EAAMX,GAAG,GAAO0D,EAAG1D,GAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,GAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,GAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,GAAG,GAAOuD,EAAGvD,GAAG,GACtBQ,EAAMP,GAAG,GAAOsD,EAAGtD,GAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,GAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,GAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,GAAG,GAAO4C,EAAG5C,GAAG,GACtBI,EAAMH,GAAG,GAAO2C,EAAG3C,GAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,GAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,GAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,GAAKmD,EAAQM,GAAG/C,GAAG,GACnBT,GAAKmD,EAAQK,GAAG9C,GAAG,GAGnBL,EAAMI,GAAG,GAAO2C,EAAG3C,GAAG,GACtBH,EAAMI,GAAG,GAAO0C,EAAG1C,GAAG,GAGhBiC,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAK0C,EAAI1C,KAAO,CAC7B,IAAMV,GAAK,EAAGA,GAAKmD,EAAInD,KACtBN,EAAMK,IAAOT,EAAKG,EAAMK,KACxBA,IAAMH,EACNI,IAAMH,EAEPE,IAAMM,EACNL,IAAMM,CACN,CACDP,IAAMa,EACNZ,IAAMa,CACN,CACDd,IAAMiB,EACNhB,IAAMiB,CACN,CACDlB,IAAMqB,EACNpB,IAAMqB,CACN,CACDtB,IAAMyB,EACNxB,IAAMyB,CACN,CACD1B,IAAM6B,EACN5B,IAAM6B,CACN,CACD9B,IAAMiC,EACNhC,IAAMiC,CACN,CACDlC,IAAMqC,EACNpC,IAAMqC,CACN,CACDtC,IAAMyC,EACNxC,IAAMyC,CACN,CAWZ,G/BzQIqD,EAAyB,CgCK7B,SAAyBzG,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAR,EACAS,EACA4C,EACAC,EACA5C,EACA6C,EACAC,EACA5C,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACA6C,EACAC,EACAC,EA8BJ,IAxBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZY,EAAKlD,EAAG,GAAIkD,EAAK,GAUtB,IATKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPC,EAAMI,EAAOG,EAAGhD,EAAG,GACnB0C,EAAMI,EAAOE,EAAG/C,EAAG,GACb8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBC,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CAGJ,EC3FA,SAAyBjB,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAf,EACAS,EACAO,EACAqC,EACAY,EACAX,EACAY,EACAxD,EACA6C,EACAC,EACAW,EACAvD,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAyC,EACAC,EACAQ,EACAP,EA8BJ,IAxBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZoB,EAAK1D,EAAG,GAAI0D,EAAK,GAUtB,IATKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPa,EAAMR,EAAOW,EAAGxD,EAAG,GACnBsD,EAAMR,EAAOU,EAAGvD,EAAG,GACb+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBK,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CAIL,ECrHA,SAAyBxB,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAnB,EACAS,EACAO,EACAI,EACAiC,EACAY,EACAI,EACAf,EACAY,EACAI,EACA5D,EACA6C,EACAC,EACAW,EACAI,EACA3D,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAqC,EACAC,EACAQ,EACAI,EACAX,EA8BJ,IAxBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZwB,EAAK9D,EAAG,GAAI8D,EAAK,GAUtB,IATKA,EAAKpB,GACTmB,EAAKC,EACLA,EAAK,IAELD,EAAKnB,EACLoB,GAAMpB,GAEPiB,EAAMZ,EAAOe,EAAG5D,EAAG,GACnB0D,EAAMZ,EAAOc,EAAG3D,EAAG,GACbuD,EAAK1D,EAAG,GAAI0D,EAAK,GAYtB,IAXKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,EAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,EAAGvD,EAAG,GACd+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBS,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CAKN,EC7IA,SAAyB5B,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAvB,EACAS,EACAO,EACAI,EACAI,EACA6B,EACAY,EACAI,EACAI,EACAnB,EACAY,EACAI,EACAI,EACAhE,EACA6C,EACAC,EACAW,EACAI,EACAI,EACA/D,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAiC,EACAC,EACAQ,EACAI,EACAI,EACAf,EA8BJ,IAxBAnD,GADAmD,EAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,EAAEjD,GACPC,EAAKgD,EAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZ4B,EAAKlE,EAAG,GAAIkE,EAAK,GAUtB,IATKA,EAAKxB,GACTuB,EAAKC,EACLA,EAAK,IAELD,EAAKvB,EACLwB,GAAMxB,GAEPqB,EAAMhB,EAAOmB,EAAGhE,EAAG,GACnB8D,EAAMhB,EAAOkB,EAAG/D,EAAG,GACb2D,EAAK9D,EAAG,GAAI8D,EAAK,GAYtB,IAXKA,EAAKpB,GACTmB,EAAKC,EACLA,EAAK,IAELD,EAAKnB,EACLoB,GAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,EAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,EAAG3D,EAAG,GACduD,EAAK1D,EAAG,GAAI0D,EAAK,GAYtB,IAXKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,EAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,EAAGvD,EAAG,GACd+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBa,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CAMP,ECrKA,SAAyBhC,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACA3B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAyB,EACAY,EACAI,EACAI,EACAI,EACAvB,EACAY,EACAI,EACAI,EACAI,EACApE,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAnE,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,EACAI,EACA6B,EACAC,EACAQ,EACAI,GACAI,GACAI,GACAnB,GA8BJ,IAxBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZgC,GAAKtE,EAAG,GAAIsE,GAAK,GAUtB,IATKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPyB,EAAMpB,EAAOuB,GAAGpE,EAAG,GACnBkE,EAAMpB,EAAOsB,GAAGnE,EAAG,GACb+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,EAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,EAAG,GACduD,EAAK1D,EAAG,GAAI0D,EAAK,GAYtB,IAXKA,EAAKhB,GACTe,EAAKC,EACLA,EAAK,IAELD,EAAKf,EACLgB,GAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,EAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,EAAGvD,EAAG,GACd+C,EAAKlD,EAAG,GAAIkD,EAAK,GAYtB,IAXKA,EAAKR,GACTI,EAAKI,EACLA,EAAK,IAELJ,EAAKJ,EACLQ,GAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,EAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,EAAG/C,EAAG,GACd8C,EAAKjD,EAAG,GAAIiD,EAAK,GAiBtB,IAhBKA,EAAKP,GACTG,EAAKI,EACLA,EAAK,IAELJ,EAAKH,EACLO,GAAMP,GAGPlD,EAAKmD,EAAQM,EAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,EAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBiB,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CAOR,EC7LA,SAAyBpC,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACA/B,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAqB,EACAY,EACAI,EACAI,EACAI,EACAI,EACA3B,EACAY,EACAI,EACAI,EACAI,EACAI,EACAxE,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAvE,EACAC,EACA4C,EACAC,EACAxD,EACAC,EACAC,EACAU,EACAI,EACAI,EACAI,GACAI,GACAI,GACAyB,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAvB,GA8BJ,IAxBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZoC,GAAK1E,EAAG,GAAI0E,GAAK,GAUtB,IATKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEP6B,EAAMxB,EAAO2B,GAAGxE,EAAG,GACnBsE,EAAMxB,EAAO0B,GAAGvE,EAAG,GACbmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,EAAG,GAAOmE,EAAGnE,EAAG,GACtBoB,EAAMnB,EAAG,GAAOkE,EAAGlE,EAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,EAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,EAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,EAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,EAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,EAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,EAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,EAAKmD,EAAQM,GAAG/C,EAAG,GACnBT,EAAKmD,EAAQK,GAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhBqB,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAKiD,EAAIjD,IAAO,CAC7B,IAAMJ,EAAK,EAAGA,EAAK0C,EAAI1C,IAAO,CAC7B,IAAMV,EAAK,EAAGA,EAAKmD,EAAInD,IACtB8C,EAAKpD,EAAMK,EAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,GAAMH,EAEPE,GAAMM,EACNL,GAAMM,CACN,CACDP,GAAMa,EACNZ,GAAMa,CACN,CACDd,GAAMiB,EACNhB,GAAMiB,CACN,CACDlB,GAAMqB,EACNpB,GAAMqB,CACN,CACDtB,GAAMyB,EACNxB,GAAMyB,CACN,CACD1B,GAAM6B,EACN5B,GAAM6B,CACN,CAQT,ECrNA,SAAyBxC,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAnC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAiB,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACA/B,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACA5E,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAI,EACA3E,EACAC,EACA4C,EACAC,EACAxD,EACAC,GACAC,GACAU,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAqB,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAI,GACA3B,GA8BJ,IAxBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,EAAKiD,GAAEjD,GACPC,EAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,EAAG,GACTZ,EAAMa,EAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZwC,GAAK9E,EAAG,GAAI8E,GAAK,GAUtB,IATKA,GAAKpC,GACTmC,EAAKC,GACLA,GAAK,IAELD,EAAKnC,EACLoC,IAAMpC,GAEPiC,EAAM5B,EAAO+B,GAAG5E,EAAG,GACnB0E,EAAM5B,EAAO8B,GAAG3E,EAAG,GACbuE,GAAK1E,EAAG,GAAI0E,GAAK,GAYtB,IAXKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEPjB,EAAMvB,EAAG,GAAOuE,EAAGvE,EAAG,GACtBwB,EAAMvB,EAAG,GAAOsE,EAAGtE,EAAG,GACtBoE,EAAMI,EAAQD,GAAGxE,EAAG,GACpBsE,EAAMI,EAAQF,GAAGvE,EAAG,GACdmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,EAAG,GAAOmE,EAAGnE,EAAG,GACtBoB,EAAMnB,EAAG,GAAOkE,EAAGlE,EAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,EAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,EAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,EAAG,GAAO+D,EAAG/D,EAAG,GACtBgB,EAAMf,EAAG,GAAO8D,EAAG9D,EAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,EAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,EAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,EAAG,GAAO2D,EAAG3D,EAAG,GACtBY,EAAMX,EAAG,GAAO0D,EAAG1D,EAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,EAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,EAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,EAAG,GAAOuD,EAAGvD,EAAG,GACtBQ,EAAMP,EAAG,GAAOsD,EAAGtD,EAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,EAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,EAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,EAAG,GAAO4C,EAAG5C,EAAG,GACtBI,EAAMH,EAAG,GAAO2C,EAAG3C,EAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,EAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,EAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,EAAKmD,EAAQM,GAAG/C,EAAG,GACnBT,GAAKmD,EAAQK,GAAG9C,EAAG,GAGnBL,EAAMI,EAAG,GAAO2C,EAAG3C,EAAG,GACtBH,EAAMI,EAAG,GAAO0C,EAAG1C,EAAG,GAGhByB,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAK0C,EAAI1C,KAAO,CAC7B,IAAMV,GAAK,EAAGA,GAAKmD,EAAInD,KACtB8C,EAAKpD,EAAMK,GAAIT,EAAKuD,EAAKpD,EAAMK,KAC/BA,GAAMH,EACNI,IAAMH,EAEPE,GAAMM,EACNL,IAAMM,CACN,CACDP,GAAMa,EACNZ,IAAMa,CACN,CACDd,GAAMiB,EACNhB,IAAMiB,CACN,CACDlB,GAAMqB,EACNpB,IAAMqB,CACN,CACDtB,GAAMyB,EACNxB,IAAMyB,CACN,CACD1B,GAAM6B,EACN5B,IAAM6B,CACN,CACD9B,GAAMiC,EACNhC,IAAMiC,CACN,CASV,EC7OA,SAAyB5C,EAAGC,EAAGC,GAC9B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAvC,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAa,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAnC,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAhF,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA/E,GACAC,GACA4C,GACAC,GACAxD,GACAC,GACAC,GACAU,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAiB,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACA/B,GA8BJ,IAxBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,GAAKiD,GAAEjD,GACPC,GAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,GAAKjE,EAAEI,OACP8D,GAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,GAAG,GACTZ,EAAMa,GAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZ4C,GAAKlF,EAAG,GAAIkF,GAAK,GAUtB,IATKA,GAAKxC,GACTuC,EAAKC,GACLA,GAAK,IAELD,EAAKvC,EACLwC,IAAMxC,GAEPqC,EAAMhC,GAAOmC,GAAGhF,GAAG,GACnB8E,EAAMhC,GAAOkC,GAAG/E,GAAG,GACb2E,GAAK9E,EAAG,GAAI8E,GAAK,GAYtB,IAXKA,GAAKpC,GACTmC,EAAKC,GACLA,GAAK,IAELD,EAAKnC,EACLoC,IAAMpC,GAEPb,EAAM3B,GAAG,GAAO2E,EAAG3E,GAAG,GACtB4B,EAAM3B,GAAG,GAAO0E,EAAG1E,GAAG,GACtBwE,EAAMI,EAAQD,GAAG5E,GAAG,GACpB0E,EAAMI,EAAQF,GAAG3E,GAAG,GACduE,GAAK1E,EAAG,GAAI0E,GAAK,GAYtB,IAXKA,GAAKhC,GACT+B,EAAKC,GACLA,GAAK,IAELD,EAAK/B,EACLgC,IAAMhC,GAEPjB,EAAMvB,GAAG,GAAOuE,EAAGvE,GAAG,GACtBwB,EAAMvB,GAAG,GAAOsE,EAAGtE,GAAG,GACtBoE,EAAMI,EAAQD,GAAGxE,GAAG,GACpBsE,EAAMI,EAAQF,GAAGvE,GAAG,GACdmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,EAAKC,GACLA,GAAK,IAELD,EAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,GAAG,GAAOmE,EAAGnE,GAAG,GACtBoB,EAAMnB,GAAG,GAAOkE,EAAGlE,GAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,GAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,GAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,GAAG,GAAO+D,EAAG/D,GAAG,GACtBgB,EAAMf,GAAG,GAAO8D,EAAG9D,GAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,GAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,GAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,GAAG,GAAO2D,EAAG3D,GAAG,GACtBY,EAAMX,GAAG,GAAO0D,EAAG1D,GAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,GAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,GAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,GAAG,GAAOuD,EAAGvD,GAAG,GACtBQ,EAAMP,GAAG,GAAOsD,EAAGtD,GAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,GAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,GAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,GAAG,GAAO4C,EAAG5C,GAAG,GACtBI,EAAMH,GAAG,GAAO2C,EAAG3C,GAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,GAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,GAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,GAAKmD,EAAQM,GAAG/C,GAAG,GACnBT,GAAKmD,EAAQK,GAAG9C,GAAG,GAGnBL,EAAMI,GAAG,GAAO2C,EAAG3C,GAAG,GACtBH,EAAMI,GAAG,GAAO0C,EAAG1C,GAAG,GAGhB6B,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAK0C,EAAI1C,KAAO,CAC7B,IAAMV,GAAK,EAAGA,GAAKmD,EAAInD,KACtB8C,EAAKpD,EAAMK,GAAIT,EAAKuD,EAAKpD,EAAMK,MAC/BA,IAAMH,EACNI,IAAMH,EAEPE,IAAMM,EACNL,IAAMM,CACN,CACDP,IAAMa,EACNZ,IAAMa,CACN,CACDd,IAAMiB,EACNhB,IAAMiB,CACN,CACDlB,IAAMqB,EACNpB,IAAMqB,CACN,CACDtB,IAAMyB,EACNxB,IAAMyB,CACN,CACD1B,IAAM6B,EACN5B,IAAM6B,CACN,CACD9B,IAAMiC,EACNhC,IAAMiC,CACN,CACDlC,IAAMqC,EACNpC,IAAMqC,CACN,CAUX,ECrQA,SAA0BhD,EAAGC,EAAGC,GAC/B,IAAI0D,EACAvD,EACAC,EACAmD,EACAC,EACAnD,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACA3C,EACAS,EACAO,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAS,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAvC,EACAY,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACAI,EACApF,EACA6C,EACAC,EACAW,EACAI,EACAI,EACAI,GACAI,GACAI,GACAI,GACAI,GACAnF,GACAC,GACA4C,GACAC,GACAxD,GACAC,GACAC,GACAU,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAa,GACAC,GACAQ,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAI,GACAnC,GA8BJ,IAxBAnD,GADAmD,GAAIC,EAAWtE,EAAEa,MAAOb,EAAEc,QAASb,EAAEa,UAC9BI,GACPE,GAAKiD,GAAEjD,GACPC,GAAKgD,GAAEhD,GAGPuC,EAAQW,EAAWvE,EAAEwE,MAAOvE,EAAEuE,OAG9BP,GAAKjE,EAAEI,OACP8D,GAAKjE,EAAEG,OAGPC,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTI,EAAMa,GAAG,GACTZ,EAAMa,GAAG,GAGToC,EAAMzD,EAAEwD,UAAU,GAClBE,EAAMzD,EAAEuD,UAAU,GAGZgD,GAAKtF,EAAG,GAAIsF,GAAK,GAUtB,IATKA,GAAK5C,GACT2C,GAAKC,GACLA,GAAK,IAELD,GAAK3C,EACL4C,IAAM5C,GAEPyC,EAAMpC,GAAOuC,GAAGpF,GAAG,GACnBkF,EAAMpC,GAAOsC,GAAGnF,GAAG,GACb+E,GAAKlF,EAAG,GAAIkF,GAAK,GAYtB,IAXKA,GAAKxC,GACTuC,GAAKC,GACLA,GAAK,IAELD,GAAKvC,EACLwC,IAAMxC,GAEPT,EAAM/B,GAAG,GAAO+E,GAAG/E,GAAG,GACtBgC,EAAM/B,GAAG,GAAO8E,GAAG9E,GAAG,GACtB4E,EAAMI,EAAQD,GAAGhF,GAAG,GACpB8E,EAAMI,EAAQF,GAAG/E,GAAG,GACd2E,GAAK9E,EAAG,GAAI8E,GAAK,GAYtB,IAXKA,GAAKpC,GACTmC,GAAKC,GACLA,GAAK,IAELD,GAAKnC,EACLoC,IAAMpC,GAEPb,EAAM3B,GAAG,GAAO2E,GAAG3E,GAAG,GACtB4B,EAAM3B,GAAG,GAAO0E,GAAG1E,GAAG,GACtBwE,EAAMI,EAAQD,GAAG5E,GAAG,GACpB0E,EAAMI,EAAQF,GAAG3E,GAAG,GACduE,GAAK1E,EAAG,GAAI0E,GAAK,GAYtB,IAXKA,GAAKhC,GACT+B,GAAKC,GACLA,GAAK,IAELD,GAAK/B,EACLgC,IAAMhC,GAEPjB,EAAMvB,GAAG,GAAOuE,GAAGvE,GAAG,GACtBwB,EAAMvB,GAAG,GAAOsE,GAAGtE,GAAG,GACtBoE,EAAMI,EAAQD,GAAGxE,GAAG,GACpBsE,EAAMI,EAAQF,GAAGvE,GAAG,GACdmE,GAAKtE,EAAG,GAAIsE,GAAK,GAYtB,IAXKA,GAAK5B,GACT2B,GAAKC,GACLA,GAAK,IAELD,GAAK3B,EACL4B,IAAM5B,GAEPrB,EAAMnB,GAAG,GAAOmE,GAAGnE,GAAG,GACtBoB,EAAMnB,GAAG,GAAOkE,GAAGlE,GAAG,GACtBgE,EAAMI,EAAQD,GAAGpE,GAAG,GACpBkE,EAAMI,EAAQF,GAAGnE,GAAG,GACd+D,GAAKlE,EAAG,GAAIkE,GAAK,GAYtB,IAXKA,GAAKxB,GACTuB,EAAKC,GACLA,GAAK,IAELD,EAAKvB,EACLwB,IAAMxB,GAEPzB,EAAMf,GAAG,GAAO+D,EAAG/D,GAAG,GACtBgB,EAAMf,GAAG,GAAO8D,EAAG9D,GAAG,GACtB4D,EAAMI,EAAQD,GAAGhE,GAAG,GACpB8D,EAAMI,EAAQF,GAAG/D,GAAG,GACd2D,GAAK9D,EAAG,GAAI8D,GAAK,GAYtB,IAXKA,GAAKpB,GACTmB,EAAKC,GACLA,GAAK,IAELD,EAAKnB,EACLoB,IAAMpB,GAEP7B,EAAMX,GAAG,GAAO2D,EAAG3D,GAAG,GACtBY,EAAMX,GAAG,GAAO0D,EAAG1D,GAAG,GACtBwD,EAAMI,EAAQD,GAAG5D,GAAG,GACpB0D,EAAMI,EAAQF,GAAG3D,GAAG,GACduD,GAAK1D,EAAG,GAAI0D,GAAK,GAYtB,IAXKA,GAAKhB,GACTe,EAAKC,GACLA,GAAK,IAELD,EAAKf,EACLgB,IAAMhB,GAEPjC,EAAMP,GAAG,GAAOuD,EAAGvD,GAAG,GACtBQ,EAAMP,GAAG,GAAOsD,EAAGtD,GAAG,GACtBoD,EAAMI,EAAQD,GAAGxD,GAAG,GACpBsD,EAAMI,EAAQF,GAAGvD,GAAG,GACd+C,GAAKlD,EAAG,GAAIkD,GAAK,GAYtB,IAXKA,GAAKR,GACTI,EAAKI,GACLA,GAAK,IAELJ,EAAKJ,EACLQ,IAAMR,GAEPrC,EAAMH,GAAG,GAAO4C,EAAG5C,GAAG,GACtBI,EAAMH,GAAG,GAAO2C,EAAG3C,GAAG,GACtBwC,EAAMY,EAAQL,GAAGhD,GAAG,GACpB0C,EAAMY,EAAQN,GAAG/C,GAAG,GACd8C,GAAKjD,EAAG,GAAIiD,GAAK,GAiBtB,IAhBKA,GAAKP,GACTG,EAAKI,GACLA,GAAK,IAELJ,EAAKH,EACLO,IAAMP,GAGPlD,GAAKmD,EAAQM,GAAG/C,GAAG,GACnBT,GAAKmD,EAAQK,GAAG9C,GAAG,GAGnBL,EAAMI,GAAG,GAAO2C,EAAG3C,GAAG,GACtBH,EAAMI,GAAG,GAAO0C,EAAG1C,GAAG,GAGhBiC,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,GAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAKiD,EAAIjD,KAAO,CAC7B,IAAMJ,GAAK,EAAGA,GAAK0C,EAAI1C,KAAO,CAC7B,IAAMV,GAAK,EAAGA,GAAKmD,EAAInD,KACtB8C,EAAKpD,EAAMK,GAAIT,EAAKuD,EAAKpD,EAAMK,MAC/BA,IAAMH,EACNI,IAAMH,EAEPE,IAAMM,EACNL,IAAMM,CACN,CACDP,IAAMa,EACNZ,IAAMa,CACN,CACDd,IAAMiB,EACNhB,IAAMiB,CACN,CACDlB,IAAMqB,EACNpB,IAAMqB,CACN,CACDtB,IAAMyB,EACNxB,IAAMyB,CACN,CACD1B,IAAM6B,EACN5B,IAAM6B,CACN,CACD9B,IAAMiC,EACNhC,IAAMiC,CACN,CACDlC,IAAMqC,EACNpC,IAAMqC,CACN,CACDtC,IAAMyC,EACNxC,IAAMyC,CACN,CAWZ,GxCzRIsD,EAAW3G,EAAM4G,OAAS,EAuE9B,SAASC,EAAOC,EAAQ3G,GACvB,IAAI4G,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAlG,EACAC,EACA4C,EACAC,EACAqD,EACAvH,EACAC,EACAuH,EACAC,EAUJ,GAPAzH,EAAI0H,EAAgBb,EAAQ,IAC5B5G,EAAIyH,EAAgBb,EAAQ,IAG5BI,EAAMjH,EAAEa,MACRqG,EAAMjH,EAAEY,OACRiG,EAAQG,EAAIN,UACGO,EAAIP,OAClB,MAAM,IAAIgB,MAAOC,EAAQ,uHAAwHd,EAAOI,EAAIP,SAG7J,GAAe,IAAVG,EACJ,OAAK9G,EAAE6H,kBAAoB5H,EAAE4H,iBACrBtE,EAAgBuD,GAAS9G,EAAGC,EAAGC,GAEhCH,EAAO+G,GAAS9G,EAAGC,EAAGC,GAK9B,IAFAmH,EAAM,EACNE,EAAK,EACCE,EAAI,EAAGA,EAAIX,EAAOW,IAAM,CAE7B,IADAD,EAAIP,EAAKQ,MACEP,EAAKO,GACf,MAAM,IAAIE,MAAOC,EAAO,UAGzBP,GAAOG,EAGI,IAANA,IACJD,GAAM,EAEP,CAED,GAAa,IAARF,EAAL,CAIA,GAAe,IAAVP,EACJ,OAAK9G,EAAE6H,kBAAoB5H,EAAE4H,iBACrBtE,EAAgBuD,GAAS9G,EAAGC,EAAGC,GAEhCH,EAAO+G,GAAS9G,EAAGC,EAAGC,GAM9B,GAJAkB,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QAGFyG,IAAOT,EAAM,EAAI,CAErB,IAAMW,EAAI,EAAGA,EAAIX,GACE,IAAbG,EAAKQ,GADaA,KASxB,OAJAzH,EAAEa,MAAQ,CAAEoG,EAAIQ,IAChBxH,EAAEY,MAAQb,EAAEa,MACZb,EAAEc,QAAU,CAAEM,EAAGqG,IACjBxH,EAAEa,QAAU,CAAEO,EAAGoG,IACZzH,EAAE6H,kBAAoB5H,EAAE4H,iBACrBtE,EAAgB,GAAKvD,EAAGC,EAAGC,GAE5BH,EAAO,GAAKC,EAAGC,EAAGC,EACzB,CAMD,GALAiH,EAAMW,EAAgB1G,GACtBgG,EAAMU,EAAgBzG,GAGtBiG,EAAMS,EAAe3G,GACR,IAAR+F,GAAqB,IAARC,GAAaE,IAAQS,EAAe1G,GAAO,CAM5D,GAJA0F,EAAOiB,EAAuBf,EAAK7F,EAAIpB,EAAEI,QACzC4G,EAAOgB,EAAuBd,EAAK7F,EAAIpB,EAAEG,QAGpCiH,IAAUN,EAAK,GAAGA,EAAK,GAAG,GAAOM,IAAUL,EAAK,GAAGA,EAAK,GAAG,EAkB/D,OAfC/C,EADY,IAARkD,EACCJ,EAAM,GAENA,EAAM,GAGX7C,EADY,IAARkD,EACCJ,EAAM,GAENA,EAAM,GAEZhH,EAAEa,MAAQ,CAAEwG,GACZpH,EAAEY,MAAQb,EAAEa,MACZb,EAAEc,QAAU,CAAEqG,GACdlH,EAAEa,QAAU,CAAEsG,GACdpH,EAAEI,OAAS6D,EACXhE,EAAEG,OAAS8D,EACNlE,EAAE6H,kBAAoB5H,EAAE4H,iBACrBtE,EAAgB,GAAKvD,EAAGC,EAAGC,GAE5BH,EAAO,GAAKC,EAAGC,EAAGC,GAK1B,GAAK4G,GAASJ,EAEb,OAAK1G,EAAE6H,kBAAoB5H,EAAE4H,iBACrBtE,EAAgBuD,GAAS9G,EAAGC,EAAGqH,EAAKpH,GAErCH,EAAO+G,GAAS9G,EAAGC,EAAGqH,EAAKpH,EAGnC,CAID,OAAK4G,GAASJ,EACR1G,EAAE6H,kBAAoB5H,EAAE4H,iBACrBpB,EAAwBK,EAAM,GAAK9G,EAAGC,EAAGC,GAE1CyD,EAAemD,EAAM,GAAK9G,EAAGC,EAAGC,GAGnCF,EAAE6H,kBAAoB5H,EAAE4H,iBFpN9B,SAAkB7H,EAAGC,EAAGC,GACvB,IAAIG,EACAC,EACA2H,EACAC,EACAb,EACA5D,EACAC,EACAxC,EACAE,EACAC,EACA4C,EACAC,EACAxD,EAEA+G,EA4BJ,IA1BAvG,EAAKlB,EAAEa,MAGPwG,EAAMc,EAAOjH,GAGbb,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTiB,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QAGPmD,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGP6H,EAAOjI,EAAEoI,MACTF,EAAOjI,EAAEmI,MAGT3E,EAAMzD,EAAEwD,UAAW,GACnBE,EAAMzD,EAAEuD,UAAW,GAGbiE,EAAI,EAAGA,EAAIJ,EAAKI,IACrB/G,EAAK2H,EAAWnH,EAAIE,EAAI6C,EAAIgE,EAAMR,EAAG3H,GAErC4D,EAAKpD,EADA+H,EAAWnH,EAAIG,EAAI6C,EAAIgE,EAAMT,EAAG3H,GACtBI,EAAKuD,EAAKpD,EAAMK,IAEjC,CEqKS4H,CAAiBtI,EAAGC,EAAGC,QD1OhC,SAAkBF,EAAGC,EAAGC,GACvB,IAAIG,EACAC,EACA2H,EACAC,EACAb,EACAnG,EACAE,EACAC,EACA4C,EACAC,EACAxD,EAEA+G,EAwBJ,IAtBAvG,EAAKlB,EAAEa,MAGPwG,EAAMc,EAAOjH,GAGbb,EAAOL,EAAEG,KACTG,EAAOL,EAAEE,KAGTiB,EAAKpB,EAAEc,QACPO,EAAKpB,EAAEa,QAGPmD,EAAKjE,EAAEI,OACP8D,EAAKjE,EAAEG,OAGP6H,EAAOjI,EAAEoI,MACTF,EAAOjI,EAAEmI,MAGHX,EAAI,EAAGA,EAAIJ,EAAKI,IACrB/G,EAAK2H,EAAWnH,EAAIE,EAAI6C,EAAIgE,EAAMR,EAAG3H,GAErCQ,EADK+H,EAAWnH,EAAIG,EAAI6C,EAAIgE,EAAMT,EAAG3H,IACxBI,EAAKG,EAAMK,GAE1B,CCkMC6H,CAASvI,EAAGC,EAAGC,EAvFd,CAwFF"} \ No newline at end of file diff --git a/lib/0d.js b/lib/0d.js deleted file mode 100644 index 3f2b773..0000000 --- a/lib/0d.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a zero-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0 ] ); -* var ybuf = new Float64Array( 1 ); -* -* // Define the shape of the input and output arrays: -* var shape = []; -* -* // Define the array strides: -* var sx = [ 0 ]; -* var sy = [ 0 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary0d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0 ] -*/ -function unary0d( x, y, fcn ) { - y.data[ y.offset ] = fcn( x.data[ x.offset ] ); -} - - -// EXPORTS // - -module.exports = unary0d; diff --git a/lib/0d_accessors.js b/lib/0d_accessors.js deleted file mode 100644 index 7a628eb..0000000 --- a/lib/0d_accessors.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a zero-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -* var ybuf = new Complex64Array( 2 ); -* -* // Define the shape of the input and output arrays: -* var shape = []; -* -* // Define the array strides: -* var sx = [ 0 ]; -* var sy = [ 0 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary0d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 30.0 -* -* var im = imagf( v ); -* // returns 40.0 -*/ -function unary0d( x, y, fcn ) { - y.accessors[ 1 ]( y.data, y.offset, fcn( x.accessors[ 0 ]( x.data, x.offset ) ) ); // eslint-disable-line max-len -} - - -// EXPORTS // - -module.exports = unary0d; diff --git a/lib/10d.js b/lib/10d.js deleted file mode 100644 index 8de30a6..0000000 --- a/lib/10d.js +++ /dev/null @@ -1,268 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary10d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dx9; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var dy9; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var S7; - var S8; - var S9; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - var i9; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 9 ]; - S1 = sh[ 8 ]; - S2 = sh[ 7 ]; - S3 = sh[ 6 ]; - S4 = sh[ 5 ]; - S5 = sh[ 4 ]; - S6 = sh[ 3 ]; - S7 = sh[ 2 ]; - S8 = sh[ 1 ]; - S9 = sh[ 0 ]; - dx0 = sx[ 9 ]; // offset increment for innermost loop - dx1 = sx[ 8 ] - ( S0*sx[9] ); - dx2 = sx[ 7 ] - ( S1*sx[8] ); - dx3 = sx[ 6 ] - ( S2*sx[7] ); - dx4 = sx[ 5 ] - ( S3*sx[6] ); - dx5 = sx[ 4 ] - ( S4*sx[5] ); - dx6 = sx[ 3 ] - ( S5*sx[4] ); - dx7 = sx[ 2 ] - ( S6*sx[3] ); - dx8 = sx[ 1 ] - ( S7*sx[2] ); - dx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 9 ]; - dy1 = sy[ 8 ] - ( S0*sy[9] ); - dy2 = sy[ 7 ] - ( S1*sy[8] ); - dy3 = sy[ 6 ] - ( S2*sy[7] ); - dy4 = sy[ 5 ] - ( S3*sy[6] ); - dy5 = sy[ 4 ] - ( S4*sy[5] ); - dy6 = sy[ 3 ] - ( S5*sy[4] ); - dy7 = sy[ 2 ] - ( S6*sy[3] ); - dy8 = sy[ 1 ] - ( S7*sy[2] ); - dy9 = sy[ 0 ] - ( S8*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - S7 = sh[ 7 ]; - S8 = sh[ 8 ]; - S9 = sh[ 9 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); - dx7 = sx[ 7 ] - ( S6*sx[6] ); - dx8 = sx[ 8 ] - ( S7*sx[7] ); - dx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - dy7 = sy[ 7 ] - ( S6*sy[6] ); - dy8 = sy[ 8 ] - ( S7*sy[7] ); - dy9 = sy[ 9 ] - ( S8*sy[8] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i9 = 0; i9 < S9; i9++ ) { - for ( i8 = 0; i8 < S8; i8++ ) { - for ( i7 = 0; i7 < S7; i7++ ) { - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } - ix += dx9; - iy += dy9; - } -} - - -// EXPORTS // - -module.exports = unary10d; diff --git a/lib/10d_accessors.js b/lib/10d_accessors.js deleted file mode 100644 index b24111d..0000000 --- a/lib/10d_accessors.js +++ /dev/null @@ -1,295 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary10d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary10d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dx9; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var dy9; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var S7; - var S8; - var S9; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - var i9; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 9 ]; - S1 = sh[ 8 ]; - S2 = sh[ 7 ]; - S3 = sh[ 6 ]; - S4 = sh[ 5 ]; - S5 = sh[ 4 ]; - S6 = sh[ 3 ]; - S7 = sh[ 2 ]; - S8 = sh[ 1 ]; - S9 = sh[ 0 ]; - dx0 = sx[ 9 ]; // offset increment for innermost loop - dx1 = sx[ 8 ] - ( S0*sx[9] ); - dx2 = sx[ 7 ] - ( S1*sx[8] ); - dx3 = sx[ 6 ] - ( S2*sx[7] ); - dx4 = sx[ 5 ] - ( S3*sx[6] ); - dx5 = sx[ 4 ] - ( S4*sx[5] ); - dx6 = sx[ 3 ] - ( S5*sx[4] ); - dx7 = sx[ 2 ] - ( S6*sx[3] ); - dx8 = sx[ 1 ] - ( S7*sx[2] ); - dx9 = sx[ 0 ] - ( S8*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 9 ]; - dy1 = sy[ 8 ] - ( S0*sy[9] ); - dy2 = sy[ 7 ] - ( S1*sy[8] ); - dy3 = sy[ 6 ] - ( S2*sy[7] ); - dy4 = sy[ 5 ] - ( S3*sy[6] ); - dy5 = sy[ 4 ] - ( S4*sy[5] ); - dy6 = sy[ 3 ] - ( S5*sy[4] ); - dy7 = sy[ 2 ] - ( S6*sy[3] ); - dy8 = sy[ 1 ] - ( S7*sy[2] ); - dy9 = sy[ 0 ] - ( S8*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - S7 = sh[ 7 ]; - S8 = sh[ 8 ]; - S9 = sh[ 9 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); - dx7 = sx[ 7 ] - ( S6*sx[6] ); - dx8 = sx[ 8 ] - ( S7*sx[7] ); - dx9 = sx[ 9 ] - ( S8*sx[8] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - dy7 = sy[ 7 ] - ( S6*sy[6] ); - dy8 = sy[ 8 ] - ( S7*sy[7] ); - dy9 = sy[ 9 ] - ( S8*sy[8] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i9 = 0; i9 < S9; i9++ ) { - for ( i8 = 0; i8 < S8; i8++ ) { - for ( i7 = 0; i7 < S7; i7++ ) { - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); // eslint-disable-line max-len - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } - ix += dx9; - iy += dy9; - } -} - - -// EXPORTS // - -module.exports = unary10d; diff --git a/lib/10d_blocked.js b/lib/10d_blocked.js deleted file mode 100644 index 7adb2bd..0000000 --- a/lib/10d_blocked.js +++ /dev/null @@ -1,381 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary10d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary10d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dx9; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var dy9; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var ox7; - var ox8; - var ox9; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var oy7; - var oy8; - var oy9; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var s7; - var s8; - var s9; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - var i9; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var j7; - var j8; - var j9; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j9 = sh[9]; j9 > 0; ) { - if ( j9 < bsize ) { - s9 = j9; - j9 = 0; - } else { - s9 = bsize; - j9 -= bsize; - } - ox9 = ox + ( j9*sx[9] ); - oy9 = oy + ( j9*sy[9] ); - for ( j8 = sh[8]; j8 > 0; ) { - if ( j8 < bsize ) { - s8 = j8; - j8 = 0; - } else { - s8 = bsize; - j8 -= bsize; - } - dx9 = sx[9] - ( s8*sx[8] ); - dy9 = sy[9] - ( s8*sy[8] ); - ox8 = ox9 + ( j8*sx[8] ); - oy8 = oy9 + ( j8*sy[8] ); - for ( j7 = sh[7]; j7 > 0; ) { - if ( j7 < bsize ) { - s7 = j7; - j7 = 0; - } else { - s7 = bsize; - j7 -= bsize; - } - dx8 = sx[8] - ( s7*sx[7] ); - dy8 = sy[8] - ( s7*sy[7] ); - ox7 = ox8 + ( j7*sx[7] ); - oy7 = oy8 + ( j7*sy[7] ); - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - dx7 = sx[7] - ( s6*sx[6] ); - dy7 = sy[7] - ( s6*sy[6] ); - ox6 = ox7 + ( j6*sx[6] ); - oy6 = oy7 + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i9 = 0; i9 < s9; i9++ ) { - for ( i8 = 0; i8 < s8; i8++ ) { - for ( i7 = 0; i7 < s7; i7++ ) { - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } - ix += dx9; - iy += dy9; - } - } - } - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary10d; diff --git a/lib/10d_blocked_accessors.js b/lib/10d_blocked_accessors.js deleted file mode 100644 index 27b8baa..0000000 --- a/lib/10d_blocked_accessors.js +++ /dev/null @@ -1,408 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a ten-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary10d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary10d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dx9; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var dy9; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var ox7; - var ox8; - var ox9; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var oy7; - var oy8; - var oy9; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var s7; - var s8; - var s9; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - var i9; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var j7; - var j8; - var j9; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j9 = sh[9]; j9 > 0; ) { - if ( j9 < bsize ) { - s9 = j9; - j9 = 0; - } else { - s9 = bsize; - j9 -= bsize; - } - ox9 = ox + ( j9*sx[9] ); - oy9 = oy + ( j9*sy[9] ); - for ( j8 = sh[8]; j8 > 0; ) { - if ( j8 < bsize ) { - s8 = j8; - j8 = 0; - } else { - s8 = bsize; - j8 -= bsize; - } - dx9 = sx[9] - ( s8*sx[8] ); - dy9 = sy[9] - ( s8*sy[8] ); - ox8 = ox9 + ( j8*sx[8] ); - oy8 = oy9 + ( j8*sy[8] ); - for ( j7 = sh[7]; j7 > 0; ) { - if ( j7 < bsize ) { - s7 = j7; - j7 = 0; - } else { - s7 = bsize; - j7 -= bsize; - } - dx8 = sx[8] - ( s7*sx[7] ); - dy8 = sy[8] - ( s7*sy[7] ); - ox7 = ox8 + ( j7*sx[7] ); - oy7 = oy8 + ( j7*sy[7] ); - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - dx7 = sx[7] - ( s6*sx[6] ); - dy7 = sy[7] - ( s6*sy[6] ); - ox6 = ox7 + ( j6*sx[6] ); - oy6 = oy7 + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i9 = 0; i9 < s9; i9++ ) { - for ( i8 = 0; i8 < s8; i8++ ) { - for ( i7 = 0; i7 < s7; i7++ ) { - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } - ix += dx9; - iy += dy9; - } - } - } - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary10d; diff --git a/lib/1d.js b/lib/1d.js deleted file mode 100644 index 3d84b5f..0000000 --- a/lib/1d.js +++ /dev/null @@ -1,126 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a one-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Float64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 4 ]; -* -* // Define the array strides: -* var sx = [ 2 ]; -* var sy = [ 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary1d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 40.0, 60.0, 80.0 ] -*/ -function unary1d( x, y, fcn ) { - var xbuf; - var ybuf; - var dx0; - var dy0; - var S0; - var ix; - var iy; - var i0; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables: dimensions and loop offset (pointer) increments... - S0 = x.shape[ 0 ]; - dx0 = x.strides[ 0 ]; - dy0 = y.strides[ 0 ]; - - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } -} - - -// EXPORTS // - -module.exports = unary1d; diff --git a/lib/1d_accessors.js b/lib/1d_accessors.js deleted file mode 100644 index d72a693..0000000 --- a/lib/1d_accessors.js +++ /dev/null @@ -1,153 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a one-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 4 ]; -* -* // Define the array strides: -* var sx = [ 1 ]; -* var sy = [ 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary1d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary1d( x, y, fcn ) { - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dy0; - var S0; - var ix; - var iy; - var i0; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables: dimensions and loop offset (pointer) increments... - S0 = x.shape[ 0 ]; - dx0 = x.strides[ 0 ]; - dy0 = y.strides[ 0 ]; - - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } -} - - -// EXPORTS // - -module.exports = unary1d; diff --git a/lib/2d.js b/lib/2d.js deleted file mode 100644 index 9248570..0000000 --- a/lib/2d.js +++ /dev/null @@ -1,154 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Float64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 1 ]; -* var sy = [ 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary2d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0 ] -*/ -function unary2d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var dx0; - var dx1; - var dy0; - var dy1; - var sh; - var S0; - var S1; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 1 ]; - S1 = sh[ 0 ]; - dx0 = sx[ 1 ]; // offset increment for innermost loop - dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 1 ]; - dy1 = sy[ 0 ] - ( S0*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } -} - - -// EXPORTS // - -module.exports = unary2d; diff --git a/lib/2d_accessors.js b/lib/2d_accessors.js deleted file mode 100644 index 74ac01d..0000000 --- a/lib/2d_accessors.js +++ /dev/null @@ -1,181 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 2, 1 ]; -* var sy = [ 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary2d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary2d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dy0; - var dy1; - var sh; - var S0; - var S1; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 1 ]; - S1 = sh[ 0 ]; - dx0 = sx[ 1 ]; // offset increment for innermost loop - dx1 = sx[ 0 ] - ( S0*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 1 ]; - dy1 = sy[ 0 ] - ( S0*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } -} - - -// EXPORTS // - -module.exports = unary2d; diff --git a/lib/2d_blocked.js b/lib/2d_blocked.js deleted file mode 100644 index 8287c33..0000000 --- a/lib/2d_blocked.js +++ /dev/null @@ -1,187 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Float64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 1 ]; -* var sy = [ 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary2d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0 ] -*/ -function blockedunary2d( x, y, fcn ) { - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dy0; - var dy1; - var ox1; - var oy1; - var sh; - var s0; - var s1; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var j0; - var j1; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - ox1 = ox + ( j1*sx[1] ); - oy1 = oy + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary2d; diff --git a/lib/2d_blocked_accessors.js b/lib/2d_blocked_accessors.js deleted file mode 100644 index e9fdf34..0000000 --- a/lib/2d_blocked_accessors.js +++ /dev/null @@ -1,214 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a two-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 2, 1 ]; -* var sy = [ 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary2d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary2d( x, y, fcn ) { - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dy0; - var dy1; - var ox1; - var oy1; - var sh; - var s0; - var s1; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var j0; - var j1; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - ox1 = ox + ( j1*sx[1] ); - oy1 = oy + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary2d; diff --git a/lib/3d.js b/lib/3d.js deleted file mode 100644 index cc4d9cf..0000000 --- a/lib/3d.js +++ /dev/null @@ -1,168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 1 ]; -* var sy = [ 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary3d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary3d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dy0; - var dy1; - var dy2; - var sh; - var S0; - var S1; - var S2; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 2 ]; - S1 = sh[ 1 ]; - S2 = sh[ 0 ]; - dx0 = sx[ 2 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[2] ); - dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 2 ]; - dy1 = sy[ 1 ] - ( S0*sy[2] ); - dy2 = sy[ 0 ] - ( S1*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } -} - - -// EXPORTS // - -module.exports = unary3d; diff --git a/lib/3d_accessors.js b/lib/3d_accessors.js deleted file mode 100644 index a511cf7..0000000 --- a/lib/3d_accessors.js +++ /dev/null @@ -1,195 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 2, 1 ]; -* var sy = [ 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary3d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary3d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dy0; - var dy1; - var dy2; - var sh; - var S0; - var S1; - var S2; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 2 ]; - S1 = sh[ 1 ]; - S2 = sh[ 0 ]; - dx0 = sx[ 2 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[2] ); - dx2 = sx[ 0 ] - ( S1*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 2 ]; - dy1 = sy[ 1 ] - ( S0*sy[2] ); - dy2 = sy[ 0 ] - ( S1*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } -} - - -// EXPORTS // - -module.exports = unary3d; diff --git a/lib/3d_blocked.js b/lib/3d_blocked.js deleted file mode 100644 index b811a89..0000000 --- a/lib/3d_blocked.js +++ /dev/null @@ -1,213 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 1 ]; -* var sy = [ 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary3d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary3d( x, y, fcn ) { - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dy0; - var dy1; - var dy2; - var ox1; - var ox2; - var oy1; - var oy2; - var sh; - var s0; - var s1; - var s2; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var j0; - var j1; - var j2; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - ox2 = ox + ( j2*sx[2] ); - oy2 = oy + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary3d; diff --git a/lib/3d_blocked_accessors.js b/lib/3d_blocked_accessors.js deleted file mode 100644 index e190610..0000000 --- a/lib/3d_blocked_accessors.js +++ /dev/null @@ -1,240 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a three-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 2, 1 ]; -* var sy = [ 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary3d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary3d( x, y, fcn ) { - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dy0; - var dy1; - var dy2; - var ox1; - var ox2; - var oy1; - var oy2; - var sh; - var s0; - var s1; - var s2; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var j0; - var j1; - var j2; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - ox2 = ox + ( j2*sx[2] ); - oy2 = oy + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary3d; diff --git a/lib/4d.js b/lib/4d.js deleted file mode 100644 index a696329..0000000 --- a/lib/4d.js +++ /dev/null @@ -1,182 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 4, 4, 1 ]; -* var sy = [ 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary4d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary4d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dy0; - var dy1; - var dy2; - var dy3; - var sh; - var S0; - var S1; - var S2; - var S3; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 3 ]; - S1 = sh[ 2 ]; - S2 = sh[ 1 ]; - S3 = sh[ 0 ]; - dx0 = sx[ 3 ]; // offset increment for innermost loop - dx1 = sx[ 2 ] - ( S0*sx[3] ); - dx2 = sx[ 1 ] - ( S1*sx[2] ); - dx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 3 ]; - dy1 = sy[ 2 ] - ( S0*sy[3] ); - dy2 = sy[ 1 ] - ( S1*sy[2] ); - dy3 = sy[ 0 ] - ( S2*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } -} - - -// EXPORTS // - -module.exports = unary4d; diff --git a/lib/4d_accessors.js b/lib/4d_accessors.js deleted file mode 100644 index d5d882a..0000000 --- a/lib/4d_accessors.js +++ /dev/null @@ -1,209 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary4d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary4d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dy0; - var dy1; - var dy2; - var dy3; - var sh; - var S0; - var S1; - var S2; - var S3; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 3 ]; - S1 = sh[ 2 ]; - S2 = sh[ 1 ]; - S3 = sh[ 0 ]; - dx0 = sx[ 3 ]; // offset increment for innermost loop - dx1 = sx[ 2 ] - ( S0*sx[3] ); - dx2 = sx[ 1 ] - ( S1*sx[2] ); - dx3 = sx[ 0 ] - ( S2*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 3 ]; - dy1 = sy[ 2 ] - ( S0*sy[3] ); - dy2 = sy[ 1 ] - ( S1*sy[2] ); - dy3 = sy[ 0 ] - ( S2*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } -} - - -// EXPORTS // - -module.exports = unary4d; diff --git a/lib/4d_blocked.js b/lib/4d_blocked.js deleted file mode 100644 index 5638a88..0000000 --- a/lib/4d_blocked.js +++ /dev/null @@ -1,237 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 4, 4, 1 ]; -* var sy = [ 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary4d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary4d( x, y, fcn ) { - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dy0; - var dy1; - var dy2; - var dy3; - var ox1; - var ox2; - var ox3; - var oy1; - var oy2; - var oy3; - var sh; - var s0; - var s1; - var s2; - var s3; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var j0; - var j1; - var j2; - var j3; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - ox3 = ox + ( j3*sx[3] ); - oy3 = oy + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary4d; diff --git a/lib/4d_blocked_accessors.js b/lib/4d_blocked_accessors.js deleted file mode 100644 index a715e5a..0000000 --- a/lib/4d_blocked_accessors.js +++ /dev/null @@ -1,264 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a four-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary4d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary4d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dy0; - var dy1; - var dy2; - var dy3; - var ox1; - var ox2; - var ox3; - var oy1; - var oy2; - var oy3; - var sh; - var s0; - var s1; - var s2; - var s3; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var j0; - var j1; - var j2; - var j3; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - ox3 = ox + ( j3*sx[3] ); - oy3 = oy + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary4d; diff --git a/lib/5d.js b/lib/5d.js deleted file mode 100644 index 31f9a57..0000000 --- a/lib/5d.js +++ /dev/null @@ -1,196 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary5d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary5d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 4 ]; - S1 = sh[ 3 ]; - S2 = sh[ 2 ]; - S3 = sh[ 1 ]; - S4 = sh[ 0 ]; - dx0 = sx[ 4 ]; // offset increment for innermost loop - dx1 = sx[ 3 ] - ( S0*sx[4] ); - dx2 = sx[ 2 ] - ( S1*sx[3] ); - dx3 = sx[ 1 ] - ( S2*sx[2] ); - dx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 4 ]; - dy1 = sy[ 3 ] - ( S0*sy[4] ); - dy2 = sy[ 2 ] - ( S1*sy[3] ); - dy3 = sy[ 1 ] - ( S2*sy[2] ); - dy4 = sy[ 0 ] - ( S3*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } -} - - -// EXPORTS // - -module.exports = unary5d; diff --git a/lib/5d_accessors.js b/lib/5d_accessors.js deleted file mode 100644 index 0431c51..0000000 --- a/lib/5d_accessors.js +++ /dev/null @@ -1,223 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 // - -/** -* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary5d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary5d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 4 ]; - S1 = sh[ 3 ]; - S2 = sh[ 2 ]; - S3 = sh[ 1 ]; - S4 = sh[ 0 ]; - dx0 = sx[ 4 ]; // offset increment for innermost loop - dx1 = sx[ 3 ] - ( S0*sx[4] ); - dx2 = sx[ 2 ] - ( S1*sx[3] ); - dx3 = sx[ 1 ] - ( S2*sx[2] ); - dx4 = sx[ 0 ] - ( S3*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 4 ]; - dy1 = sy[ 3 ] - ( S0*sy[4] ); - dy2 = sy[ 2 ] - ( S1*sy[3] ); - dy3 = sy[ 1 ] - ( S2*sy[2] ); - dy4 = sy[ 0 ] - ( S3*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } -} - - -// EXPORTS // - -module.exports = unary5d; diff --git a/lib/5d_blocked.js b/lib/5d_blocked.js deleted file mode 100644 index d51d966..0000000 --- a/lib/5d_blocked.js +++ /dev/null @@ -1,261 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary5d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary5d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var ox1; - var ox2; - var ox3; - var ox4; - var oy1; - var oy2; - var oy3; - var oy4; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var j0; - var j1; - var j2; - var j3; - var j4; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - ox4 = ox + ( j4*sx[4] ); - oy4 = oy + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary5d; diff --git a/lib/5d_blocked_accessors.js b/lib/5d_blocked_accessors.js deleted file mode 100644 index 20d77ab..0000000 --- a/lib/5d_blocked_accessors.js +++ /dev/null @@ -1,288 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a five-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary5d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary5d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var ox1; - var ox2; - var ox3; - var ox4; - var oy1; - var oy2; - var oy3; - var oy4; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var j0; - var j1; - var j2; - var j3; - var j4; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - ox4 = ox + ( j4*sx[4] ); - oy4 = oy + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); // eslint-disable-line max-len - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary5d; diff --git a/lib/6d.js b/lib/6d.js deleted file mode 100644 index 67b7cb9..0000000 --- a/lib/6d.js +++ /dev/null @@ -1,212 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary6d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary6d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 5 ]; - S1 = sh[ 4 ]; - S2 = sh[ 3 ]; - S3 = sh[ 2 ]; - S4 = sh[ 1 ]; - S5 = sh[ 0 ]; - dx0 = sx[ 5 ]; // offset increment for innermost loop - dx1 = sx[ 4 ] - ( S0*sx[5] ); - dx2 = sx[ 3 ] - ( S1*sx[4] ); - dx3 = sx[ 2 ] - ( S2*sx[3] ); - dx4 = sx[ 1 ] - ( S3*sx[2] ); - dx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 5 ]; - dy1 = sy[ 4 ] - ( S0*sy[5] ); - dy2 = sy[ 3 ] - ( S1*sy[4] ); - dy3 = sy[ 2 ] - ( S2*sy[3] ); - dy4 = sy[ 1 ] - ( S3*sy[2] ); - dy5 = sy[ 0 ] - ( S4*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } -} - - -// EXPORTS // - -module.exports = unary6d; diff --git a/lib/6d_accessors.js b/lib/6d_accessors.js deleted file mode 100644 index 45f8500..0000000 --- a/lib/6d_accessors.js +++ /dev/null @@ -1,239 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary6d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary6d( x, y, isRowMajor, fcn ) { - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 5 ]; - S1 = sh[ 4 ]; - S2 = sh[ 3 ]; - S3 = sh[ 2 ]; - S4 = sh[ 1 ]; - S5 = sh[ 0 ]; - dx0 = sx[ 5 ]; // offset increment for innermost loop - dx1 = sx[ 4 ] - ( S0*sx[5] ); - dx2 = sx[ 3 ] - ( S1*sx[4] ); - dx3 = sx[ 2 ] - ( S2*sx[3] ); - dx4 = sx[ 1 ] - ( S3*sx[2] ); - dx5 = sx[ 0 ] - ( S4*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 5 ]; - dy1 = sy[ 4 ] - ( S0*sy[5] ); - dy2 = sy[ 3 ] - ( S1*sy[4] ); - dy3 = sy[ 2 ] - ( S2*sy[3] ); - dy4 = sy[ 1 ] - ( S3*sy[2] ); - dy5 = sy[ 0 ] - ( S4*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } -} - - -// EXPORTS // - -module.exports = unary6d; diff --git a/lib/6d_blocked.js b/lib/6d_blocked.js deleted file mode 100644 index 628f26e..0000000 --- a/lib/6d_blocked.js +++ /dev/null @@ -1,285 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary6d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary6d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - ox5 = ox + ( j5*sx[5] ); - oy5 = oy + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary6d; diff --git a/lib/6d_blocked_accessors.js b/lib/6d_blocked_accessors.js deleted file mode 100644 index 5949baa..0000000 --- a/lib/6d_blocked_accessors.js +++ /dev/null @@ -1,312 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a six-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary6d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary6d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - ox5 = ox + ( j5*sx[5] ); - oy5 = oy + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary6d; diff --git a/lib/7d.js b/lib/7d.js deleted file mode 100644 index 91fbec0..0000000 --- a/lib/7d.js +++ /dev/null @@ -1,226 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary7d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary7d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 6 ]; - S1 = sh[ 5 ]; - S2 = sh[ 4 ]; - S3 = sh[ 3 ]; - S4 = sh[ 2 ]; - S5 = sh[ 1 ]; - S6 = sh[ 0 ]; - dx0 = sx[ 6 ]; // offset increment for innermost loop - dx1 = sx[ 5 ] - ( S0*sx[6] ); - dx2 = sx[ 4 ] - ( S1*sx[5] ); - dx3 = sx[ 3 ] - ( S2*sx[4] ); - dx4 = sx[ 2 ] - ( S3*sx[3] ); - dx5 = sx[ 1 ] - ( S4*sx[2] ); - dx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 6 ]; - dy1 = sy[ 5 ] - ( S0*sy[6] ); - dy2 = sy[ 4 ] - ( S1*sy[5] ); - dy3 = sy[ 3 ] - ( S2*sy[4] ); - dy4 = sy[ 2 ] - ( S3*sy[3] ); - dy5 = sy[ 1 ] - ( S4*sy[2] ); - dy6 = sy[ 0 ] - ( S5*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } -} - - -// EXPORTS // - -module.exports = unary7d; diff --git a/lib/7d_accessors.js b/lib/7d_accessors.js deleted file mode 100644 index 91457dd..0000000 --- a/lib/7d_accessors.js +++ /dev/null @@ -1,253 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary7d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary7d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 6 ]; - S1 = sh[ 5 ]; - S2 = sh[ 4 ]; - S3 = sh[ 3 ]; - S4 = sh[ 2 ]; - S5 = sh[ 1 ]; - S6 = sh[ 0 ]; - dx0 = sx[ 6 ]; // offset increment for innermost loop - dx1 = sx[ 5 ] - ( S0*sx[6] ); - dx2 = sx[ 4 ] - ( S1*sx[5] ); - dx3 = sx[ 3 ] - ( S2*sx[4] ); - dx4 = sx[ 2 ] - ( S3*sx[3] ); - dx5 = sx[ 1 ] - ( S4*sx[2] ); - dx6 = sx[ 0 ] - ( S5*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 6 ]; - dy1 = sy[ 5 ] - ( S0*sy[6] ); - dy2 = sy[ 4 ] - ( S1*sy[5] ); - dy3 = sy[ 3 ] - ( S2*sy[4] ); - dy4 = sy[ 2 ] - ( S3*sy[3] ); - dy5 = sy[ 1 ] - ( S4*sy[2] ); - dy6 = sy[ 0 ] - ( S5*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } -} - - -// EXPORTS // - -module.exports = unary7d; diff --git a/lib/7d_blocked.js b/lib/7d_blocked.js deleted file mode 100644 index 5d7708c..0000000 --- a/lib/7d_blocked.js +++ /dev/null @@ -1,309 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary7d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary7d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - ox6 = ox + ( j6*sx[6] ); - oy6 = oy + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary7d; diff --git a/lib/7d_blocked_accessors.js b/lib/7d_blocked_accessors.js deleted file mode 100644 index 094892f..0000000 --- a/lib/7d_blocked_accessors.js +++ /dev/null @@ -1,336 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a seven-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary7d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary7d( x, y, fcn ) { // eslint-disable-line max-statements - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - ox6 = ox + ( j6*sx[6] ); - oy6 = oy + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary7d; diff --git a/lib/8d.js b/lib/8d.js deleted file mode 100644 index 3424533..0000000 --- a/lib/8d.js +++ /dev/null @@ -1,240 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary8d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary8d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var S7; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 7 ]; - S1 = sh[ 6 ]; - S2 = sh[ 5 ]; - S3 = sh[ 4 ]; - S4 = sh[ 3 ]; - S5 = sh[ 2 ]; - S6 = sh[ 1 ]; - S7 = sh[ 0 ]; - dx0 = sx[ 7 ]; // offset increment for innermost loop - dx1 = sx[ 6 ] - ( S0*sx[7] ); - dx2 = sx[ 5 ] - ( S1*sx[6] ); - dx3 = sx[ 4 ] - ( S2*sx[5] ); - dx4 = sx[ 3 ] - ( S3*sx[4] ); - dx5 = sx[ 2 ] - ( S4*sx[3] ); - dx6 = sx[ 1 ] - ( S5*sx[2] ); - dx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 7 ]; - dy1 = sy[ 6 ] - ( S0*sy[7] ); - dy2 = sy[ 5 ] - ( S1*sy[6] ); - dy3 = sy[ 4 ] - ( S2*sy[5] ); - dy4 = sy[ 3 ] - ( S3*sy[4] ); - dy5 = sy[ 2 ] - ( S4*sy[3] ); - dy6 = sy[ 1 ] - ( S5*sy[2] ); - dy7 = sy[ 0 ] - ( S6*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - S7 = sh[ 7 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); - dx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - dy7 = sy[ 7 ] - ( S6*sy[6] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i7 = 0; i7 < S7; i7++ ) { - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } -} - - -// EXPORTS // - -module.exports = unary8d; diff --git a/lib/8d_accessors.js b/lib/8d_accessors.js deleted file mode 100644 index b43c520..0000000 --- a/lib/8d_accessors.js +++ /dev/null @@ -1,267 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary8d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary8d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var S7; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 7 ]; - S1 = sh[ 6 ]; - S2 = sh[ 5 ]; - S3 = sh[ 4 ]; - S4 = sh[ 3 ]; - S5 = sh[ 2 ]; - S6 = sh[ 1 ]; - S7 = sh[ 0 ]; - dx0 = sx[ 7 ]; // offset increment for innermost loop - dx1 = sx[ 6 ] - ( S0*sx[7] ); - dx2 = sx[ 5 ] - ( S1*sx[6] ); - dx3 = sx[ 4 ] - ( S2*sx[5] ); - dx4 = sx[ 3 ] - ( S3*sx[4] ); - dx5 = sx[ 2 ] - ( S4*sx[3] ); - dx6 = sx[ 1 ] - ( S5*sx[2] ); - dx7 = sx[ 0 ] - ( S6*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 7 ]; - dy1 = sy[ 6 ] - ( S0*sy[7] ); - dy2 = sy[ 5 ] - ( S1*sy[6] ); - dy3 = sy[ 4 ] - ( S2*sy[5] ); - dy4 = sy[ 3 ] - ( S3*sy[4] ); - dy5 = sy[ 2 ] - ( S4*sy[3] ); - dy6 = sy[ 1 ] - ( S5*sy[2] ); - dy7 = sy[ 0 ] - ( S6*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - S7 = sh[ 7 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); - dx7 = sx[ 7 ] - ( S6*sx[6] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - dy7 = sy[ 7 ] - ( S6*sy[6] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i7 = 0; i7 < S7; i7++ ) { - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } -} - - -// EXPORTS // - -module.exports = unary8d; diff --git a/lib/8d_blocked.js b/lib/8d_blocked.js deleted file mode 100644 index 68b6326..0000000 --- a/lib/8d_blocked.js +++ /dev/null @@ -1,333 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary8d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary8d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var ox7; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var oy7; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var s7; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var j7; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j7 = sh[7]; j7 > 0; ) { - if ( j7 < bsize ) { - s7 = j7; - j7 = 0; - } else { - s7 = bsize; - j7 -= bsize; - } - ox7 = ox + ( j7*sx[7] ); - oy7 = oy + ( j7*sy[7] ); - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - dx7 = sx[7] - ( s6*sx[6] ); - dy7 = sy[7] - ( s6*sy[6] ); - ox6 = ox7 + ( j6*sx[6] ); - oy6 = oy7 + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i7 = 0; i7 < s7; i7++ ) { - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary8d; diff --git a/lib/8d_blocked_accessors.js b/lib/8d_blocked_accessors.js deleted file mode 100644 index b44ff76..0000000 --- a/lib/8d_blocked_accessors.js +++ /dev/null @@ -1,360 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in an eight-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary8d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary8d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var ox7; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var oy7; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var s7; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var j7; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j7 = sh[7]; j7 > 0; ) { - if ( j7 < bsize ) { - s7 = j7; - j7 = 0; - } else { - s7 = bsize; - j7 -= bsize; - } - ox7 = ox + ( j7*sx[7] ); - oy7 = oy + ( j7*sy[7] ); - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - dx7 = sx[7] - ( s6*sx[6] ); - dy7 = sy[7] - ( s6*sy[6] ); - ox6 = ox7 + ( j6*sx[6] ); - oy6 = oy7 + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i7 = 0; i7 < s7; i7++ ) { - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary8d; diff --git a/lib/9d.js b/lib/9d.js deleted file mode 100644 index 76d5427..0000000 --- a/lib/9d.js +++ /dev/null @@ -1,254 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary9d( x, y, true, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary9d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var S7; - var S8; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 8 ]; - S1 = sh[ 7 ]; - S2 = sh[ 6 ]; - S3 = sh[ 5 ]; - S4 = sh[ 4 ]; - S5 = sh[ 3 ]; - S6 = sh[ 2 ]; - S7 = sh[ 1 ]; - S8 = sh[ 0 ]; - dx0 = sx[ 8 ]; // offset increment for innermost loop - dx1 = sx[ 7 ] - ( S0*sx[8] ); - dx2 = sx[ 6 ] - ( S1*sx[7] ); - dx3 = sx[ 5 ] - ( S2*sx[6] ); - dx4 = sx[ 4 ] - ( S3*sx[5] ); - dx5 = sx[ 3 ] - ( S4*sx[4] ); - dx6 = sx[ 2 ] - ( S5*sx[3] ); - dx7 = sx[ 1 ] - ( S6*sx[2] ); - dx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 8 ]; - dy1 = sy[ 7 ] - ( S0*sy[8] ); - dy2 = sy[ 6 ] - ( S1*sy[7] ); - dy3 = sy[ 5 ] - ( S2*sy[6] ); - dy4 = sy[ 4 ] - ( S3*sy[5] ); - dy5 = sy[ 3 ] - ( S4*sy[4] ); - dy6 = sy[ 2 ] - ( S5*sy[3] ); - dy7 = sy[ 1 ] - ( S6*sy[2] ); - dy8 = sy[ 0 ] - ( S7*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - S7 = sh[ 7 ]; - S8 = sh[ 8 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); - dx7 = sx[ 7 ] - ( S6*sx[6] ); - dx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - dy7 = sy[ 7 ] - ( S6*sy[6] ); - dy8 = sy[ 8 ] - ( S7*sy[7] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Iterate over the ndarray dimensions... - for ( i8 = 0; i8 < S8; i8++ ) { - for ( i7 = 0; i7 < S7; i7++ ) { - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } -} - - -// EXPORTS // - -module.exports = unary9d; diff --git a/lib/9d_accessors.js b/lib/9d_accessors.js deleted file mode 100644 index bc52d4a..0000000 --- a/lib/9d_accessors.js +++ /dev/null @@ -1,281 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth */ - -'use strict'; - -// MAIN // - -/** -* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {boolean} isRowMajor - boolean indicating if provided arrays are in row-major order -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unary9d( x, y, true, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unary9d( x, y, isRowMajor, fcn ) { // eslint-disable-line max-statements - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var sh; - var S0; - var S1; - var S2; - var S3; - var S4; - var S5; - var S6; - var S7; - var S8; - var sx; - var sy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... - - // Extract loop variables for purposes of loop interchange: dimensions and loop offset (pointer) increments... - sh = x.shape; - sx = x.strides; - sy = y.strides; - if ( isRowMajor ) { - // For row-major ndarrays, the last dimensions have the fastest changing indices... - S0 = sh[ 8 ]; - S1 = sh[ 7 ]; - S2 = sh[ 6 ]; - S3 = sh[ 5 ]; - S4 = sh[ 4 ]; - S5 = sh[ 3 ]; - S6 = sh[ 2 ]; - S7 = sh[ 1 ]; - S8 = sh[ 0 ]; - dx0 = sx[ 8 ]; // offset increment for innermost loop - dx1 = sx[ 7 ] - ( S0*sx[8] ); - dx2 = sx[ 6 ] - ( S1*sx[7] ); - dx3 = sx[ 5 ] - ( S2*sx[6] ); - dx4 = sx[ 4 ] - ( S3*sx[5] ); - dx5 = sx[ 3 ] - ( S4*sx[4] ); - dx6 = sx[ 2 ] - ( S5*sx[3] ); - dx7 = sx[ 1 ] - ( S6*sx[2] ); - dx8 = sx[ 0 ] - ( S7*sx[1] ); // offset increment for outermost loop - dy0 = sy[ 8 ]; - dy1 = sy[ 7 ] - ( S0*sy[8] ); - dy2 = sy[ 6 ] - ( S1*sy[7] ); - dy3 = sy[ 5 ] - ( S2*sy[6] ); - dy4 = sy[ 4 ] - ( S3*sy[5] ); - dy5 = sy[ 3 ] - ( S4*sy[4] ); - dy6 = sy[ 2 ] - ( S5*sy[3] ); - dy7 = sy[ 1 ] - ( S6*sy[2] ); - dy8 = sy[ 0 ] - ( S7*sy[1] ); - } else { // order === 'column-major' - // For column-major ndarrays, the first dimensions have the fastest changing indices... - S0 = sh[ 0 ]; - S1 = sh[ 1 ]; - S2 = sh[ 2 ]; - S3 = sh[ 3 ]; - S4 = sh[ 4 ]; - S5 = sh[ 5 ]; - S6 = sh[ 6 ]; - S7 = sh[ 7 ]; - S8 = sh[ 8 ]; - dx0 = sx[ 0 ]; // offset increment for innermost loop - dx1 = sx[ 1 ] - ( S0*sx[0] ); - dx2 = sx[ 2 ] - ( S1*sx[1] ); - dx3 = sx[ 3 ] - ( S2*sx[2] ); - dx4 = sx[ 4 ] - ( S3*sx[3] ); - dx5 = sx[ 5 ] - ( S4*sx[4] ); - dx6 = sx[ 6 ] - ( S5*sx[5] ); - dx7 = sx[ 7 ] - ( S6*sx[6] ); - dx8 = sx[ 8 ] - ( S7*sx[7] ); // offset increment for outermost loop - dy0 = sy[ 0 ]; - dy1 = sy[ 1 ] - ( S0*sy[0] ); - dy2 = sy[ 2 ] - ( S1*sy[1] ); - dy3 = sy[ 3 ] - ( S2*sy[2] ); - dy4 = sy[ 4 ] - ( S3*sy[3] ); - dy5 = sy[ 5 ] - ( S4*sy[4] ); - dy6 = sy[ 6 ] - ( S5*sy[5] ); - dy7 = sy[ 7 ] - ( S6*sy[6] ); - dy8 = sy[ 8 ] - ( S7*sy[7] ); - } - // Set the pointers to the first indexed elements in the respective ndarrays... - ix = x.offset; - iy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over the ndarray dimensions... - for ( i8 = 0; i8 < S8; i8++ ) { - for ( i7 = 0; i7 < S7; i7++ ) { - for ( i6 = 0; i6 < S6; i6++ ) { - for ( i5 = 0; i5 < S5; i5++ ) { - for ( i4 = 0; i4 < S4; i4++ ) { - for ( i3 = 0; i3 < S3; i3++ ) { - for ( i2 = 0; i2 < S2; i2++ ) { - for ( i1 = 0; i1 < S1; i1++ ) { - for ( i0 = 0; i0 < S0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } -} - - -// EXPORTS // - -module.exports = unary9d; diff --git a/lib/9d_blocked.js b/lib/9d_blocked.js deleted file mode 100644 index 8213199..0000000 --- a/lib/9d_blocked.js +++ /dev/null @@ -1,357 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 12, 12, 12, 12, 12, 12, 4, 4, 1 ]; -* var sy = [ 6, 6, 6, 6, 6, 6, 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* blockedunary9d( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function blockedunary9d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function - var bsize; - var xbuf; - var ybuf; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var ox7; - var ox8; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var oy7; - var oy8; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var s7; - var s8; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var j7; - var j8; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Iterate over blocks... - for ( j8 = sh[8]; j8 > 0; ) { - if ( j8 < bsize ) { - s8 = j8; - j8 = 0; - } else { - s8 = bsize; - j8 -= bsize; - } - ox8 = ox + ( j8*sx[8] ); - oy8 = oy + ( j8*sy[8] ); - for ( j7 = sh[7]; j7 > 0; ) { - if ( j7 < bsize ) { - s7 = j7; - j7 = 0; - } else { - s7 = bsize; - j7 -= bsize; - } - dx8 = sx[8] - ( s7*sx[7] ); - dy8 = sy[8] - ( s7*sy[7] ); - ox7 = ox8 + ( j7*sx[7] ); - oy7 = oy8 + ( j7*sy[7] ); - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - dx7 = sx[7] - ( s6*sx[6] ); - dy7 = sy[7] - ( s6*sy[6] ); - ox6 = ox7 + ( j6*sx[6] ); - oy6 = oy7 + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i8 = 0; i8 < s8; i8++ ) { - for ( i7 = 0; i7 < s7; i7++ ) { - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - ybuf[ iy ] = fcn( xbuf[ ix ] ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } - } - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary9d; diff --git a/lib/9d_blocked_accessors.js b/lib/9d_blocked_accessors.js deleted file mode 100644 index 46a9a80..0000000 --- a/lib/9d_blocked_accessors.js +++ /dev/null @@ -1,384 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-depth, max-len */ - -'use strict'; - -// MODULES // - -var loopOrder = require( '@stdlib/ndarray-base-unary-loop-interchange-order' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); - - -// MAIN // - -/** -* Applies a unary callback to elements in a nine-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray via loop blocking. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* var sy = [ 4, 4, 4, 4, 4, 4, 4, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* blockedunary9d( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function blockedunary9d( x, y, fcn ) { // eslint-disable-line max-statements, max-lines-per-function - var bsize; - var xbuf; - var ybuf; - var get; - var set; - var dx0; - var dx1; - var dx2; - var dx3; - var dx4; - var dx5; - var dx6; - var dx7; - var dx8; - var dy0; - var dy1; - var dy2; - var dy3; - var dy4; - var dy5; - var dy6; - var dy7; - var dy8; - var ox1; - var ox2; - var ox3; - var ox4; - var ox5; - var ox6; - var ox7; - var ox8; - var oy1; - var oy2; - var oy3; - var oy4; - var oy5; - var oy6; - var oy7; - var oy8; - var sh; - var s0; - var s1; - var s2; - var s3; - var s4; - var s5; - var s6; - var s7; - var s8; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i0; - var i1; - var i2; - var i3; - var i4; - var i5; - var i6; - var i7; - var i8; - var j0; - var j1; - var j2; - var j3; - var j4; - var j5; - var j6; - var j7; - var j8; - var o; - - // Note on variable naming convention: s#, dx#, dy#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... - - // Resolve the loop interchange order: - o = loopOrder( x.shape, x.strides, y.strides ); - sh = o.sh; - sx = o.sx; - sy = o.sy; - - // Determine the block size: - bsize = blockSize( x.dtype, y.dtype ); - - // Cache the indices of the first indexed elements in the respective ndarrays... - ox = x.offset; - oy = y.offset; - - // Cache references to the input and output ndarray buffers... - xbuf = x.data; - ybuf = y.data; - - // Cache offset increments for the innermost loop... - dx0 = sx[0]; - dy0 = sy[0]; - - // Cache accessors: - get = x.accessors[0]; - set = y.accessors[1]; - - // Iterate over blocks... - for ( j8 = sh[8]; j8 > 0; ) { - if ( j8 < bsize ) { - s8 = j8; - j8 = 0; - } else { - s8 = bsize; - j8 -= bsize; - } - ox8 = ox + ( j8*sx[8] ); - oy8 = oy + ( j8*sy[8] ); - for ( j7 = sh[7]; j7 > 0; ) { - if ( j7 < bsize ) { - s7 = j7; - j7 = 0; - } else { - s7 = bsize; - j7 -= bsize; - } - dx8 = sx[8] - ( s7*sx[7] ); - dy8 = sy[8] - ( s7*sy[7] ); - ox7 = ox8 + ( j7*sx[7] ); - oy7 = oy8 + ( j7*sy[7] ); - for ( j6 = sh[6]; j6 > 0; ) { - if ( j6 < bsize ) { - s6 = j6; - j6 = 0; - } else { - s6 = bsize; - j6 -= bsize; - } - dx7 = sx[7] - ( s6*sx[6] ); - dy7 = sy[7] - ( s6*sy[6] ); - ox6 = ox7 + ( j6*sx[6] ); - oy6 = oy7 + ( j6*sy[6] ); - for ( j5 = sh[5]; j5 > 0; ) { - if ( j5 < bsize ) { - s5 = j5; - j5 = 0; - } else { - s5 = bsize; - j5 -= bsize; - } - dx6 = sx[6] - ( s5*sx[5] ); - dy6 = sy[6] - ( s5*sy[5] ); - ox5 = ox6 + ( j5*sx[5] ); - oy5 = oy6 + ( j5*sy[5] ); - for ( j4 = sh[4]; j4 > 0; ) { - if ( j4 < bsize ) { - s4 = j4; - j4 = 0; - } else { - s4 = bsize; - j4 -= bsize; - } - dx5 = sx[5] - ( s4*sx[4] ); - dy5 = sy[5] - ( s4*sy[4] ); - ox4 = ox5 + ( j4*sx[4] ); - oy4 = oy5 + ( j4*sy[4] ); - for ( j3 = sh[3]; j3 > 0; ) { - if ( j3 < bsize ) { - s3 = j3; - j3 = 0; - } else { - s3 = bsize; - j3 -= bsize; - } - dx4 = sx[4] - ( s3*sx[3] ); - dy4 = sy[4] - ( s3*sy[3] ); - ox3 = ox4 + ( j3*sx[3] ); - oy3 = oy4 + ( j3*sy[3] ); - for ( j2 = sh[2]; j2 > 0; ) { - if ( j2 < bsize ) { - s2 = j2; - j2 = 0; - } else { - s2 = bsize; - j2 -= bsize; - } - dx3 = sx[3] - ( s2*sx[2] ); - dy3 = sy[3] - ( s2*sy[2] ); - ox2 = ox3 + ( j2*sx[2] ); - oy2 = oy3 + ( j2*sy[2] ); - for ( j1 = sh[1]; j1 > 0; ) { - if ( j1 < bsize ) { - s1 = j1; - j1 = 0; - } else { - s1 = bsize; - j1 -= bsize; - } - dx2 = sx[2] - ( s1*sx[1] ); - dy2 = sy[2] - ( s1*sy[1] ); - ox1 = ox2 + ( j1*sx[1] ); - oy1 = oy2 + ( j1*sy[1] ); - for ( j0 = sh[0]; j0 > 0; ) { - if ( j0 < bsize ) { - s0 = j0; - j0 = 0; - } else { - s0 = bsize; - j0 -= bsize; - } - // Compute index offsets for the first input and output ndarray elements in the current block... - ix = ox1 + ( j0*sx[0] ); - iy = oy1 + ( j0*sy[0] ); - - // Compute loop offset increments... - dx1 = sx[1] - ( s0*sx[0] ); - dy1 = sy[1] - ( s0*sy[0] ); - - // Iterate over the ndarray dimensions... - for ( i8 = 0; i8 < s8; i8++ ) { - for ( i7 = 0; i7 < s7; i7++ ) { - for ( i6 = 0; i6 < s6; i6++ ) { - for ( i5 = 0; i5 < s5; i5++ ) { - for ( i4 = 0; i4 < s4; i4++ ) { - for ( i3 = 0; i3 < s3; i3++ ) { - for ( i2 = 0; i2 < s2; i2++ ) { - for ( i1 = 0; i1 < s1; i1++ ) { - for ( i0 = 0; i0 < s0; i0++ ) { - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - ix += dx0; - iy += dy0; - } - ix += dx1; - iy += dy1; - } - ix += dx2; - iy += dy2; - } - ix += dx3; - iy += dy3; - } - ix += dx4; - iy += dy4; - } - ix += dx5; - iy += dy5; - } - ix += dx6; - iy += dy6; - } - ix += dx7; - iy += dy7; - } - ix += dx8; - iy += dy8; - } - } - } - } - } - } - } - } - } - } -} - - -// EXPORTS // - -module.exports = blockedunary9d; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index cd8c923..0000000 --- a/lib/index.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Apply a unary callback to elements in an input ndarray and assign results to elements in an output ndarray. -* -* @module @stdlib/ndarray-base-unary -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* var unary = require( '@stdlib/ndarray-base-unary' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 1 ]; -* var sy = [ 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary( [ x, y ], scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index b527308..0000000 --- a/lib/main.js +++ /dev/null @@ -1,343 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var iterationOrder = require( '@stdlib/ndarray-base-iteration-order' ); -var strides2order = require( '@stdlib/ndarray-base-strides2order' ); -var minmaxViewBufferIndex = require( '@stdlib/ndarray-base-minmax-view-buffer-index' ); -var ndarray2object = require( '@stdlib/ndarray-base-ndarraylike2object' ); -var format = require( '@stdlib/string-format' ); -var blockedaccessorunary2d = require( './2d_blocked_accessors.js' ); -var blockedaccessorunary3d = require( './3d_blocked_accessors.js' ); -var blockedaccessorunary4d = require( './4d_blocked_accessors.js' ); -var blockedaccessorunary5d = require( './5d_blocked_accessors.js' ); -var blockedaccessorunary6d = require( './6d_blocked_accessors.js' ); -var blockedaccessorunary7d = require( './7d_blocked_accessors.js' ); -var blockedaccessorunary8d = require( './8d_blocked_accessors.js' ); -var blockedaccessorunary9d = require( './9d_blocked_accessors.js' ); -var blockedaccessorunary10d = require( './10d_blocked_accessors.js' ); -var blockedunary2d = require( './2d_blocked.js' ); -var blockedunary3d = require( './3d_blocked.js' ); -var blockedunary4d = require( './4d_blocked.js' ); -var blockedunary5d = require( './5d_blocked.js' ); -var blockedunary6d = require( './6d_blocked.js' ); -var blockedunary7d = require( './7d_blocked.js' ); -var blockedunary8d = require( './8d_blocked.js' ); -var blockedunary9d = require( './9d_blocked.js' ); -var blockedunary10d = require( './10d_blocked.js' ); -var accessorunary0d = require( './0d_accessors.js' ); -var accessorunary1d = require( './1d_accessors.js' ); -var accessorunary2d = require( './2d_accessors.js' ); -var accessorunary3d = require( './3d_accessors.js' ); -var accessorunary4d = require( './4d_accessors.js' ); -var accessorunary5d = require( './5d_accessors.js' ); -var accessorunary6d = require( './6d_accessors.js' ); -var accessorunary7d = require( './7d_accessors.js' ); -var accessorunary8d = require( './8d_accessors.js' ); -var accessorunary9d = require( './9d_accessors.js' ); -var accessorunary10d = require( './10d_accessors.js' ); -var accessorunarynd = require( './nd_accessors.js' ); -var unary0d = require( './0d.js' ); -var unary1d = require( './1d.js' ); -var unary2d = require( './2d.js' ); -var unary3d = require( './3d.js' ); -var unary4d = require( './4d.js' ); -var unary5d = require( './5d.js' ); -var unary6d = require( './6d.js' ); -var unary7d = require( './7d.js' ); -var unary8d = require( './8d.js' ); -var unary9d = require( './9d.js' ); -var unary10d = require( './10d.js' ); -var unarynd = require( './nd.js' ); - - -// VARIABLES // - -var UNARY = [ - unary0d, - unary1d, - unary2d, - unary3d, - unary4d, - unary5d, - unary6d, - unary7d, - unary8d, - unary9d, - unary10d -]; -var ACCESSOR_UNARY = [ - accessorunary0d, - accessorunary1d, - accessorunary2d, - accessorunary3d, - accessorunary4d, - accessorunary5d, - accessorunary6d, - accessorunary7d, - accessorunary8d, - accessorunary9d, - accessorunary10d -]; -var BLOCKED_UNARY = [ - blockedunary2d, // 0 - blockedunary3d, - blockedunary4d, - blockedunary5d, - blockedunary6d, - blockedunary7d, - blockedunary8d, - blockedunary9d, - blockedunary10d // 8 -]; -var BLOCKED_ACCESSOR_UNARY = [ - blockedaccessorunary2d, // 0 - blockedaccessorunary3d, - blockedaccessorunary4d, - blockedaccessorunary5d, - blockedaccessorunary6d, - blockedaccessorunary7d, - blockedaccessorunary8d, - blockedaccessorunary9d, - blockedaccessorunary10d // 8 -]; -var MAX_DIMS = UNARY.length - 1; - - -// MAIN // - -/** -* Applies a unary callback to elements in an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - Each provided ndarray should be an `object` with the following properties: -* -* - **dtype**: data type. -* - **data**: data buffer. -* - **shape**: dimensions. -* - **strides**: stride lengths. -* - **offset**: index offset. -* - **order**: specifies whether an ndarray is row-major (C-style) or column major (Fortran-style). -* -* @param {ArrayLikeObject} arrays - array-like object containing one input array and one output array -* @param {Callback} fcn - unary callback -* @throws {Error} arrays must have the same number of dimensions -* @throws {Error} arrays must have the same shape -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0 ] ); -* var ybuf = new Float64Array( 6 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 3, 1, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 4, 1 ]; -* var sy = [ 2, 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unary( [ x, y ], scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0, 100.0, 110.0 ] -*/ -function unary( arrays, fcn ) { - var ndims; - var xmmv; - var ymmv; - var shx; - var shy; - var iox; - var ioy; - var len; - var ord; - var sx; - var sy; - var ox; - var oy; - var ns; - var x; - var y; - var d; - var i; - - // Unpack the ndarrays and standardize ndarray meta data: - x = ndarray2object( arrays[ 0 ] ); - y = ndarray2object( arrays[ 1 ] ); - - // Verify that the input and output arrays have the same number of dimensions... - shx = x.shape; - shy = y.shape; - ndims = shx.length; - if ( ndims !== shy.length ) { - throw new Error( format( 'invalid arguments. Arrays must have the same number of dimensions (i.e., same rank). ndims(x) == %d. ndims(y) == %d.', ndims, shy.length ) ); - } - // Determine whether we can avoid iteration altogether... - if ( ndims === 0 ) { - if ( x.accessorProtocol || y.accessorProtocol ) { - return ACCESSOR_UNARY[ ndims ]( x, y, fcn ); - } - return UNARY[ ndims ]( x, y, fcn ); - } - // Verify that the input and output arrays have the same dimensions... - len = 1; // number of elements - ns = 0; // number of singleton dimensions - for ( i = 0; i < ndims; i++ ) { - d = shx[ i ]; - if ( d !== shy[ i ] ) { - throw new Error( 'invalid arguments. Arrays must have the same shape.' ); - } - // Note that, if one of the dimensions is `0`, the length will be `0`... - len *= d; - - // Check whether the current dimension is a singleton dimension... - if ( d === 1 ) { - ns += 1; - } - } - // Check whether we were provided empty ndarrays... - if ( len === 0 ) { - return; - } - // Determine whether the ndarrays are one-dimensional and thus readily translate to one-dimensional strided arrays... - if ( ndims === 1 ) { - if ( x.accessorProtocol || y.accessorProtocol ) { - return ACCESSOR_UNARY[ ndims ]( x, y, fcn ); - } - return UNARY[ ndims ]( x, y, fcn ); - } - sx = x.strides; - sy = y.strides; - - // Determine whether the ndarray has only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays... - if ( ns === ndims-1 ) { - // Get the index of the non-singleton dimension... - for ( i = 0; i < ndims; i++ ) { - if ( shx[ i ] !== 1 ) { - break; - } - } - x.shape = [ shx[i] ]; - y.shape = x.shape; - x.strides = [ sx[i] ]; - y.strides = [ sy[i] ]; - if ( x.accessorProtocol || y.accessorProtocol ) { - return ACCESSOR_UNARY[ 1 ]( x, y, fcn ); - } - return UNARY[ 1 ]( x, y, fcn ); - } - iox = iterationOrder( sx ); // +/-1 - ioy = iterationOrder( sy ); // +/-1 - - // Determine whether we can avoid blocked iteration... - ord = strides2order( sx ); - if ( iox !== 0 && ioy !== 0 && ord === strides2order( sy ) ) { - // Determine the minimum and maximum linear indices which are accessible by the array views: - xmmv = minmaxViewBufferIndex( shx, sx, x.offset ); - ymmv = minmaxViewBufferIndex( shy, sy, y.offset ); - - // Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays... - if ( len === ( xmmv[1]-xmmv[0]+1 ) && len === ( ymmv[1]-ymmv[0]+1 ) ) { - // Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values... - if ( iox === 1 ) { - ox = xmmv[ 0 ]; - } else { - ox = xmmv[ 1 ]; - } - if ( ioy === 1 ) { - oy = ymmv[ 0 ]; - } else { - oy = ymmv[ 1 ]; - } - x.shape = [ len ]; - y.shape = x.shape; - x.strides = [ iox ]; - y.strides = [ ioy ]; - x.offset = ox; - y.offset = oy; - if ( x.accessorProtocol || y.accessorProtocol ) { - return ACCESSOR_UNARY[ 1 ]( x, y, fcn ); - } - return UNARY[ 1 ]( x, y, fcn ); - } - // At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality... - - // Determine whether we can use simple nested loops... - if ( ndims <= MAX_DIMS ) { - // So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration... - if ( x.accessorProtocol || y.accessorProtocol ) { - return ACCESSOR_UNARY[ ndims ]( x, y, ord, fcn ); - } - return UNARY[ ndims ]( x, y, ord, fcn ); - } - // Fall-through to blocked iteration... - } - // At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration... - - // Determine whether we can perform blocked iteration... - if ( ndims <= MAX_DIMS ) { - if ( x.accessorProtocol || y.accessorProtocol ) { - return BLOCKED_ACCESSOR_UNARY[ ndims-2 ]( x, y, fcn ); - } - return BLOCKED_UNARY[ ndims-2 ]( x, y, fcn ); - } - // Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)... - if ( x.accessorProtocol || y.accessorProtocol ) { - return accessorunarynd( x, y, fcn ); - } - unarynd( x, y, fcn ); -} - - -// EXPORTS // - -module.exports = unary; diff --git a/lib/nd.js b/lib/nd.js deleted file mode 100644 index 3f7f6d1..0000000 --- a/lib/nd.js +++ /dev/null @@ -1,148 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var numel = require( '@stdlib/ndarray-base-numel' ); -var vind2bind = require( '@stdlib/ndarray-base-vind2bind' ); - - -// VARIABLES // - -var MODE = 'throw'; - - -// MAIN // - -/** -* Applies a unary callback to elements in an n-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Float64Array = require( '@stdlib/array-float64' ); -* -* function scale( x ) { -* return x * 10.0; -* } -* -* // Create data buffers: -* var xbuf = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Float64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 4, 1 ]; -* var sy = [ 2, 1 ]; -* -* // Define the index offsets: -* var ox = 1; -* var oy = 0; -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'float64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major' -* }; -* var y = { -* 'dtype': 'float64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major' -* }; -* -* // Apply the unary function: -* unarynd( x, y, scale ); -* -* console.log( y.data ); -* // => [ 20.0, 30.0, 60.0, 70.0 ] -*/ -function unarynd( x, y, fcn ) { - var xbuf; - var ybuf; - var ordx; - var ordy; - var len; - var sh; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i; - - sh = x.shape; - - // Compute the total number of elements over which to iterate: - len = numel( sh ); - - // Cache references to the input and output ndarray data buffers: - xbuf = x.data; - ybuf = y.data; - - // Cache references to the respective stride arrays: - sx = x.strides; - sy = y.strides; - - // Cache the indices of the first indexed elements in the respective ndarrays: - ox = x.offset; - oy = y.offset; - - // Cache the respective array orders: - ordx = x.order; - ordy = y.order; - - // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... - for ( i = 0; i < len; i++ ) { - ix = vind2bind( sh, sx, ox, ordx, i, MODE ); - iy = vind2bind( sh, sy, oy, ordy, i, MODE ); - ybuf[ iy ] = fcn( xbuf[ ix ] ); - } -} - - -// EXPORTS // - -module.exports = unarynd; diff --git a/lib/nd_accessors.js b/lib/nd_accessors.js deleted file mode 100644 index a18f6d1..0000000 --- a/lib/nd_accessors.js +++ /dev/null @@ -1,175 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var numel = require( '@stdlib/ndarray-base-numel' ); -var vind2bind = require( '@stdlib/ndarray-base-vind2bind' ); - - -// VARIABLES // - -var MODE = 'throw'; - - -// MAIN // - -/** -* Applies a unary callback to elements in an n-dimensional input ndarray and assigns results to elements in an equivalently shaped output ndarray. -* -* @private -* @param {Object} x - object containing input ndarray meta data -* @param {string} x.dtype - data type -* @param {Collection} x.data - data buffer -* @param {NonNegativeIntegerArray} x.shape - dimensions -* @param {IntegerArray} x.strides - stride lengths -* @param {NonNegativeInteger} x.offset - index offset -* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} x.accessors - data buffer accessors -* @param {Object} y - object containing output ndarray meta data -* @param {string} y.dtype - data type -* @param {Collection} y.data - data buffer -* @param {NonNegativeIntegerArray} y.shape - dimensions -* @param {IntegerArray} y.strides - stride lengths -* @param {NonNegativeInteger} y.offset - index offset -* @param {string} y.order - specifies whether `y` is row-major (C-style) or column-major (Fortran-style) -* @param {Array} y.accessors - data buffer accessors -* @param {Callback} fcn - unary callback -* @returns {void} -* -* @example -* var Complex64Array = require( '@stdlib/array-complex64' ); -* var Complex64 = require( '@stdlib/complex-float32-ctor' ); -* var realf = require( '@stdlib/complex-float32-real' ); -* var imagf = require( '@stdlib/complex-float32-imag' ); -* -* function scale( z ) { -* return new Complex64( realf(z)*10.0, imagf(z)*10.0 ); -* } -* -* // Create data buffers: -* var xbuf = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ); -* var ybuf = new Complex64Array( 4 ); -* -* // Define the shape of the input and output arrays: -* var shape = [ 2, 2 ]; -* -* // Define the array strides: -* var sx = [ 2, 1 ]; -* var sy = [ 2, 1 ]; -* -* // Define the index offsets: -* var ox = 0; -* var oy = 0; -* -* // Define getters and setters: -* function getter( buf, idx ) { -* return buf.get( idx ); -* } -* -* function setter( buf, idx, value ) { -* buf.set( value, idx ); -* } -* -* // Create the input and output ndarray-like objects: -* var x = { -* 'dtype': 'complex64', -* 'data': xbuf, -* 'shape': shape, -* 'strides': sx, -* 'offset': ox, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* var y = { -* 'dtype': 'complex64', -* 'data': ybuf, -* 'shape': shape, -* 'strides': sy, -* 'offset': oy, -* 'order': 'row-major', -* 'accessors': [ getter, setter ] -* }; -* -* // Apply the unary function: -* unarynd( x, y, scale ); -* -* var v = y.data.get( 0 ); -* -* var re = realf( v ); -* // returns 10.0 -* -* var im = imagf( v ); -* // returns 20.0 -*/ -function unarynd( x, y, fcn ) { - var xbuf; - var ybuf; - var ordx; - var ordy; - var len; - var get; - var set; - var sh; - var sx; - var sy; - var ox; - var oy; - var ix; - var iy; - var i; - - sh = x.shape; - - // Compute the total number of elements over which to iterate: - len = numel( sh ); - - // Cache references to the input and output ndarray data buffers: - xbuf = x.data; - ybuf = y.data; - - // Cache references to the respective stride arrays: - sx = x.strides; - sy = y.strides; - - // Cache the indices of the first indexed elements in the respective ndarrays: - ox = x.offset; - oy = y.offset; - - // Cache the respective array orders: - ordx = x.order; - ordy = y.order; - - // Cache accessors: - get = x.accessors[ 0 ]; - set = y.accessors[ 1 ]; - - // Iterate over each element based on the linear **view** index, regardless as to how the data is stored in memory... - for ( i = 0; i < len; i++ ) { - ix = vind2bind( sh, sx, ox, ordx, i, MODE ); - iy = vind2bind( sh, sy, oy, ordy, i, MODE ); - set( ybuf, iy, fcn( get( xbuf, ix ) ) ); - } -} - - -// EXPORTS // - -module.exports = unarynd; diff --git a/manifest.json b/manifest.json deleted file mode 100644 index e7eeffb..0000000 --- a/manifest.json +++ /dev/null @@ -1,195 +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/b_b.c", - "./src/b_b_as_u_u.c", - "./src/b_c.c", - "./src/b_c_as_b_c.c", - "./src/b_c_as_c_c.c", - "./src/b_c_as_z_z.c", - "./src/b_d.c", - "./src/b_d_as_b_d.c", - "./src/b_d_as_d_d.c", - "./src/b_f.c", - "./src/b_f_as_b_f.c", - "./src/b_f_as_d_d.c", - "./src/b_f_as_f_f.c", - "./src/b_i.c", - "./src/b_i_as_b_i.c", - "./src/b_i_as_i_i.c", - "./src/b_k.c", - "./src/b_k_as_b_k.c", - "./src/b_k_as_i_i.c", - "./src/b_k_as_k_k.c", - "./src/b_t.c", - "./src/b_t_as_b_t.c", - "./src/b_t_as_t_t.c", - "./src/b_t_as_u_u.c", - "./src/b_u.c", - "./src/b_u_as_b_u.c", - "./src/b_u_as_u_u.c", - "./src/b_z.c", - "./src/b_z_as_b_z.c", - "./src/b_z_as_z_z.c", - "./src/c_c.c", - "./src/c_c_as_z_z.c", - "./src/c_f_as_c_f.c", - "./src/c_z.c", - "./src/c_z_as_c_z.c", - "./src/c_z_as_z_z.c", - "./src/d_d.c", - "./src/d_i_as_d_i.c", - "./src/d_z.c", - "./src/d_z_as_d_z.c", - "./src/d_z_as_z_z.c", - "./src/f_c.c", - "./src/f_c_as_c_c.c", - "./src/f_c_as_f_c.c", - "./src/f_c_as_z_z.c", - "./src/f_d.c", - "./src/f_d_as_d_d.c", - "./src/f_d_as_f_d.c", - "./src/f_f.c", - "./src/f_f_as_d_d.c", - "./src/f_i_as_f_i.c", - "./src/f_z.c", - "./src/f_z_as_f_z.c", - "./src/f_z_as_z_z.c", - "./src/i_d.c", - "./src/i_d_as_d_d.c", - "./src/i_d_as_i_d.c", - "./src/i_i.c", - "./src/i_u.c", - "./src/i_z.c", - "./src/i_z_as_i_z.c", - "./src/i_z_as_z_z.c", - "./src/k_c.c", - "./src/k_c_as_c_c.c", - "./src/k_c_as_k_c.c", - "./src/k_c_as_z_z.c", - "./src/k_d.c", - "./src/k_d_as_d_d.c", - "./src/k_d_as_k_d.c", - "./src/k_f.c", - "./src/k_f_as_d_d.c", - "./src/k_f_as_f_f.c", - "./src/k_f_as_k_f.c", - "./src/k_i.c", - "./src/k_i_as_i_i.c", - "./src/k_i_as_k_i.c", - "./src/k_k.c", - "./src/k_k_as_i_i.c", - "./src/k_t.c", - "./src/k_t_as_i_i.c", - "./src/k_u.c", - "./src/k_u_as_i_i.c", - "./src/k_z.c", - "./src/k_z_as_k_z.c", - "./src/k_z_as_z_z.c", - "./src/s_b.c", - "./src/s_c.c", - "./src/s_c_as_c_c.c", - "./src/s_c_as_s_c.c", - "./src/s_c_as_z_z.c", - "./src/s_d.c", - "./src/s_d_as_d_d.c", - "./src/s_d_as_s_d.c", - "./src/s_f.c", - "./src/s_f_as_d_d.c", - "./src/s_f_as_f_f.c", - "./src/s_f_as_s_f.c", - "./src/s_i.c", - "./src/s_i_as_i_i.c", - "./src/s_i_as_s_i.c", - "./src/s_k.c", - "./src/s_k_as_i_i.c", - "./src/s_k_as_k_k.c", - "./src/s_k_as_s_k.c", - "./src/s_s.c", - "./src/s_s_as_i_i.c", - "./src/s_t.c", - "./src/s_t_as_i_i.c", - "./src/s_u.c", - "./src/s_u_as_i_i.c", - "./src/s_z.c", - "./src/s_z_as_s_z.c", - "./src/s_z_as_z_z.c", - "./src/t_c.c", - "./src/t_c_as_c_c.c", - "./src/t_c_as_t_c.c", - "./src/t_c_as_z_z.c", - "./src/t_d.c", - "./src/t_d_as_d_d.c", - "./src/t_d_as_t_d.c", - "./src/t_f.c", - "./src/t_f_as_d_d.c", - "./src/t_f_as_f_f.c", - "./src/t_f_as_t_f.c", - "./src/t_i.c", - "./src/t_i_as_i_i.c", - "./src/t_i_as_t_i.c", - "./src/t_t.c", - "./src/t_t_as_u_u.c", - "./src/t_u.c", - "./src/t_u_as_t_u.c", - "./src/t_u_as_u_u.c", - "./src/t_z.c", - "./src/t_z_as_t_z.c", - "./src/t_z_as_z_z.c", - "./src/u_d.c", - "./src/u_d_as_d_d.c", - "./src/u_d_as_u_d.c", - "./src/u_u.c", - "./src/u_z.c", - "./src/u_z_as_u_z.c", - "./src/u_z_as_z_z.c", - "./src/x_x.c", - "./src/z_d_as_z_d.c", - "./src/z_z.c", - "./src/dispatch.c", - "./src/internal/permute.c", - "./src/internal/range.c", - "./src/internal/sort2ins.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@stdlib/complex-float32-ctor", - "@stdlib/complex-float64-ctor", - "@stdlib/ndarray-base-bytes-per-element", - "@stdlib/ndarray-base-iteration-order", - "@stdlib/ndarray-base-vind2bind", - "@stdlib/ndarray-ctor", - "@stdlib/ndarray-index-modes", - "@stdlib/ndarray-orders" - ] - } - ] -} diff --git a/package.json b/package.json index d678808..ad2a0a0 100644 --- a/package.json +++ b/package.json @@ -3,34 +3,8 @@ "version": "0.2.1", "description": "Apply a unary callback to elements in a input ndarray and assign results to elements in an output ndarray.", "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", - "scripts": "./scripts", - "src": "./src", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -39,92 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/complex-float32-ctor": "^0.0.2", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/ndarray-base-bytes-per-element": "^0.2.2", - "@stdlib/ndarray-base-iteration-order": "^0.2.2", - "@stdlib/ndarray-base-minmax-view-buffer-index": "^0.2.2", - "@stdlib/ndarray-base-ndarraylike2object": "^0.2.2", - "@stdlib/ndarray-base-numel": "^0.2.2", - "@stdlib/ndarray-base-strides2order": "^0.2.2", - "@stdlib/ndarray-base-unary-loop-interchange-order": "^0.2.1", - "@stdlib/ndarray-base-unary-tiling-block-size": "^0.2.2", - "@stdlib/ndarray-base-vind2bind": "^0.2.2", - "@stdlib/ndarray-ctor": "^0.2.2", - "@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-library-manifest": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-filled": "^0.2.1", - "@stdlib/array-filled-by": "^0.2.1", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/array-one-to": "^0.2.2", - "@stdlib/array-ones": "^0.2.1", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/array-zeros": "^0.2.2", - "@stdlib/assert-is-same-complex128array": "^0.2.2", - "@stdlib/assert-is-same-float64array": "^0.2.2", - "@stdlib/blas-base-gscal": "^0.2.2", - "@stdlib/blas-ext-base-dfill": "^0.2.2", - "@stdlib/blas-ext-base-zfill": "github:stdlib-js/blas-ext-base-zfill#main", - "@stdlib/complex-float64-imag": "^0.1.1", - "@stdlib/complex-float64-real": "^0.1.1", - "@stdlib/fs-read-dir": "^0.2.2", - "@stdlib/fs-read-file": "^0.2.2", - "@stdlib/fs-read-json": "^0.2.2", - "@stdlib/fs-unlink": "^0.2.2", - "@stdlib/fs-write-file": "^0.2.2", - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/math-base-special-abs": "^0.2.2", - "@stdlib/math-base-special-cbrt": "^0.2.2", - "@stdlib/math-base-special-floor": "^0.2.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/math-base-special-round": "^0.3.0", - "@stdlib/math-base-special-sqrt": "^0.2.2", - "@stdlib/ndarray-base-char2dtype": "^0.2.2", - "@stdlib/ndarray-base-dtype-char": "^0.2.2", - "@stdlib/ndarray-base-dtype-desc": "^0.2.2", - "@stdlib/ndarray-base-dtype2c": "^0.2.2", - "@stdlib/ndarray-base-shape2strides": "^0.2.2", - "@stdlib/ndarray-base-strides2offset": "^0.2.2", - "@stdlib/ndarray-base-to-array": "^0.2.1", - "@stdlib/ndarray-dtypes": "^0.3.0", - "@stdlib/ndarray-from-scalar": "^0.2.1", - "@stdlib/ndarray-safe-casts": "^0.3.0", - "@stdlib/number-float64-base-identity": "github:stdlib-js/number-float64-base-identity#main", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/string-replace": "^0.2.2", - "@stdlib/string-substring-after": "^0.2.2", - "@stdlib/string-substring-before": "^0.2.2", - "@stdlib/string-uppercase": "^0.3.0", - "@stdlib/time-current-year": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "base", @@ -137,7 +25,6 @@ "map", "transform" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" diff --git a/scripts/loops.js b/scripts/loops.js deleted file mode 100644 index 21c9753..0000000 --- a/scripts/loops.js +++ /dev/null @@ -1,988 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var path = require( 'path' ); -var logger = require( 'debug' ); -var readDir = require( '@stdlib/fs-read-dir' ).sync; -var unlink = require( '@stdlib/fs-unlink' ).sync; -var readFile = require( '@stdlib/fs-read-file' ).sync; -var readJSON = require( '@stdlib/fs-read-json' ).sync; -var writeFile = require( '@stdlib/fs-write-file' ).sync; -var replace = require( '@stdlib/string-replace' ); -var substringBefore = require( '@stdlib/string-substring-before' ); -var substringAfter = require( '@stdlib/string-substring-after' ); -var uppercase = require( '@stdlib/string-uppercase' ); -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var safeCasts = require( '@stdlib/ndarray-safe-casts' ); -var dtypeChar = require( '@stdlib/ndarray-base-dtype-char' ); -var dtypeDesc = require( '@stdlib/ndarray-base-dtype-desc' ); -var dtype2c = require( '@stdlib/ndarray-base-dtype2c' ); -var char2dtype = require( '@stdlib/ndarray-base-char2dtype' ); -var bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var gscal = require( '@stdlib/blas-base-gscal' ); -var filledarray = require( '@stdlib/array-filled' ); -var currentYear = require( '@stdlib/time-current-year' ); -var format = require( '@stdlib/string-format' ); - - -// VARIABLES // - -var FOPTS = { - 'encoding': 'utf8' -}; - -// Logger: -var debug = logger( 'ndarray-unary-loops:script' ); - -// Get the current year: -var CURRENT_YEAR = currentYear().toString(); - -// Specify the copyright holder: -var COPYRIGHT = 'The Stdlib Authors'; - -// Templates: -var TMPL_HEADER = readFile( path.join( __dirname, 'templates', 'header.txt' ), FOPTS ); -var TMPL_SOURCE = readFile( path.join( __dirname, 'templates', 'source.txt' ), FOPTS ); -var TMPL_README = readFile( path.join( __dirname, 'templates', 'docs.txt' ), FOPTS ); - -// Output directories: -var INCLUDE_DIR = path.resolve( __dirname, '..', 'include', 'stdlib', 'ndarray', 'base', 'unary' ); -var SRC_DIR = path.resolve( __dirname, '..', 'src' ); - -// Main header file: -var INCLUDE_MAIN = INCLUDE_DIR + '.h'; - -// Manifest file: -var MANIFEST = path.resolve( __dirname, '..', 'manifest.json' ); - -// README file: -var README = path.resolve( __dirname, '..', 'README.md' ); - -// Data types to exclude when generating loops: -var EXCLUDE_DTYPES = [ 'binary', 'generic', 'uint8c' ]; - -// Resolve a list of dtypes for which we want to create loops: -var DTYPES = filter( dtypes(), EXCLUDE_DTYPES ); - -// Define "special" loops, which cannot be readily generated according to standardized rules: -var SPECIAL_LOOPS = [ - // Support callbacks which operate on floating-point numbers and return a 32-bit signed integer (e.g., returning the exponent, high word, etc): - 'd_i_as_d_i', - 'f_i_as_f_i', - - // Support callbacks which operate on complex floating-point numbers and return real-valued floating-point numbers (e.g., returning the real component, imaginary component, magnitude, etc): - 'z_d_as_z_d', - 'c_f_as_c_f', - - // Support callbacks which downcast integer values (e.g., computing absolute value for an 8-bit signed integer via a callback which only accepts 32-bit signed integers): - 'b_b_as_u_u', - 'b_k_as_i_i', - 'b_t_as_u_u', - - 'k_k_as_i_i', - 'k_t_as_i_i', - 'k_u_as_i_i', - - 's_k_as_i_i', - 's_s_as_i_i', - 's_t_as_i_i', - 's_u_as_i_i', - - 't_t_as_u_u', - - // Support callbacks which operate on signed integers, but whose return values are always positive and can be cast to unsigned integers of the same or greater bit width: - 'i_u', - 'k_t', - 'k_u', - 's_b', - 's_t', - 's_u' -]; - -// Hash containing C macro names: -var MACROS = { - 'default': 'CLBK', - 'nocast': 'CLBK_RET_NOCAST', - 'cast': 'CLBK_ARG_CAST', - 'acast': 'CLBK_ARG_CAST_FCN', - 'rcast': 'CLBK_RET_CAST_FCN' -}; - -// Regular expression to test for a "loop" file: -var RE_LOOP_FILE = /^[a-z]_[a-z](?:_as_[a-z]_[a-z]|)\.(?:h|c)$/; - -// Regular expression to test for a "loop" file in the manifest.json: -var RE_MANIFEST_LOOP_FILE = /\.\/src\/[a-z]_[a-z](?:_as_[a-z]_[a-z]|)\.c$/; - -// Regular expression to match input and output array dtype characters: -var RE_SIGNATURE = /^([a-z])_([a-z])/; - -// Regular expression to match callback dtype characters: -var RE_CALLBACK = /_as_([a-z])_([a-z])$/; - -// Specify array shapes: -var SHAPES = [ - [], - [ 3 ], - [ 2, 2 ], - [ 2, 2, 2 ], - [ 1, 2, 2, 2 ], - [ 1, 1, 2, 2, 2 ], - [ 1, 1, 1, 2, 2, 2 ], - [ 1, 1, 1, 1, 2, 2, 2 ], - [ 1, 1, 1, 1, 1, 2, 2, 2 ], - [ 1, 1, 1, 1, 1, 1, 2, 2, 2 ], - [ 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 ] -]; - -// Array order: -var ORDER = 'row-major'; - - -// FUNCTIONS // - -/** -* Tests whether a one-letter character abbreviation corresponds to a complex number data type. -* -* @private -* @param {string} ch - one-letter character abbreviation -* @returns {boolean} test result -* -* @example -* var bool = isComplexChar( 'z' ); -* // returns true -*/ -function isComplexChar( ch ) { - return ( ch === 'c' || ch === 'z' ); -} - -/** -* Returns a callback body based on callback input and output data types. -* -* @private -* @param {string} ch1 - one-letter character abbreviation for input argument -* @param {string} ch2 - one-letter character abbreviation for output value -* @returns {string} callback body -*/ -function callbackBody( ch1, ch2 ) { - if ( isComplexChar( ch1 ) || isComplexChar( ch2 ) || ch1 !== ch2 ) { - return '// ...'; - } - return 'return x;'; -} - -/** -* Removes a list of elements from a provided list. -* -* @private -* @param {ArrayLikeObject} src - list to filter -* @param {ArrayLikeObject} list - items to remove -* @returns {ArrayLikeObject} filtered list -* -* @example -* var src = [ 'a', 'b', 'c', 'd' ]; -* var list = [ 'b', 'd' ]; -* -* var out = filter( src, list ); -* // returns [ 'a', 'c' ] -*/ -function filter( src, list ) { - var out; - var M; - var N; - var v; - var i; - var j; - - M = src.length; - N = list.length; - - out = []; - for ( i = 0; i < M; i++ ) { - v = src[ i ]; - for ( j = 0; j < N; j++ ) { - if ( v === list[ j ] ) { - break; - } - } - if ( j === N ) { - out.push( v ); - } - } - return out; -} - -/** -* Removes loop files from a directory. -* -* @private -* @param {string} dir - directory -*/ -function removeLoopFiles( dir ) { - var list; - var i; - - list = readDir( dir ); - for ( i = 0; i < list.length; i++ ) { - if ( RE_LOOP_FILE.test( list[ i ] ) ) { - unlink( path.join( dir, list[ i ] ) ); - } - } -} - -/** -* Generates a list of loop signatures from a list of data types. -* -* @private -* @param {StringArray} dtypes - list of data types -* @returns {StringArray} list of loop signatures -*/ -function signatures( dtypes ) { - var casts; - var out; - var ch1; - var ch2; - var t1; - var t2; - var N; - var s; - var i; - var j; - - N = dtypes.length; - - // Generate the list of signatures: - out = []; - for ( i = 0; i < N; i++ ) { - t1 = dtypes[ i ]; - - // Resolve single-letter dtype abbreviation: - ch1 = dtypeChar( t1 ); - - // Generate the input/output array signature: - s = ch1+'_'+ch1; // e.g., d_d - out.push( s ); - - // Resolve the list of safe casts for the input dtype: - casts = safeCasts( t1 ); - - // Remove the excluded dtypes: - casts = filter( casts, EXCLUDE_DTYPES ); - - // Generate signatures for allowed casts: - for ( j = 0; j < casts.length; j++ ) { - t2 = casts[ j ]; - if ( t2 === t1 ) { - // For float dtypes, allow downcasting from a higher precision... - if ( ch1 === 'f' ) { - out.push( ch1+'_'+ch1+'_as_d_d' ); // e.g., `f_f` => `f_f_as_d_d` - } else if ( ch1 === 'c' ) { - out.push( ch1+'_'+ch1+'_as_z_z' ); // e.g., `c_c` => `c_c_as_z_z` - } - continue; - } - ch2 = dtypeChar( t2 ); - s = ch1+'_'+ch2; - - out.push( s ); // e.g., `b_i` - out.push( s+'_as_'+s ); // e.g., `b_i_as_b_i` - out.push( s+'_as_'+ch2+'_'+ch2 ); // e.g., `b_i_as_i_i` - - // For float dtypes, allow downcasting from a higher precision... - if ( ch2 === 'f' ) { - out.push( s+'_as_d_d' ); // e.g., `b_f` => `b_f_as_d_d` - } else if ( ch2 === 'c' ) { - out.push( s+'_as_z_z' ); // e.g., `b_c` => `b_c_as_z_z` - } - } - } - // Append any special loops: - for ( i = 0; i < SPECIAL_LOOPS.length; i++ ) { - out.push( SPECIAL_LOOPS[ i ] ); - } - return out.sort(); -} - -/** -* Defines byte arrays in a provided template string. -* -* @private -* @param {string} tmpl - template string -* @param {PositiveInteger} nb1 - bytes per element for input array -* @param {PositiveInteger} nb2 - bytes per element for output array -* @returns {string} updated string -*/ -function defineByteArrays( tmpl, nb1, nb2 ) { - var bytes; - var tmp; - var N; - var i; - - bytes = filledarray( 0, nb1, 'generic' ).join( ', ' ); - tmpl = replace( tmpl, '{{INPUT_NDARRAY_1_BYTES_0D}}', bytes ); - - bytes = filledarray( 0, nb2, 'generic' ).join( ', ' ); - tmpl = replace( tmpl, '{{OUTPUT_NDARRAY_BYTES_0D}}', bytes ); - - for ( i = 1; i < SHAPES.length; i++ ) { - N = numel( SHAPES[ i ] ); - - tmp = '{{INPUT_NDARRAY_1_BYTES_'+i+'D}}'; - bytes = filledarray( 0, nb1*N, 'generic' ).join( ', ' ); - tmpl = replace( tmpl, tmp, bytes ); - - tmp = '{{OUTPUT_NDARRAY_BYTES_'+i+'D}}'; - bytes = filledarray( 0, nb2*N, 'generic' ).join( ', ' ); - tmpl = replace( tmpl, tmp, bytes ); - } - return tmpl; -} - -/** -* Defines array strides in a provided template string. -* -* @private -* @param {string} tmpl - template string -* @param {PositiveInteger} nb1 - bytes per element for input array -* @param {PositiveInteger} nb2 - bytes per element for output array -* @returns {string} updated string -*/ -function defineStrides( tmpl, nb1, nb2 ) { - var strides; - var tmp; - var st; - var i; - - for ( i = 1; i < SHAPES.length; i++ ) { - strides = shape2strides( SHAPES[ i ], ORDER ); - - tmp = '{{INPUT_NDARRAY_1_STRIDES_'+i+'D}}'; - st = gscal( strides.length, nb1, strides.slice(), 1 ); - tmpl = replace( tmpl, tmp, st.join( ', ' ) ); - - tmp = '{{OUTPUT_NDARRAY_STRIDES_'+i+'D}}'; - st = gscal( strides.length, nb2, strides.slice(), 1 ); - tmpl = replace( tmpl, tmp, st.join( ', ' ) ); - } - return tmpl; -} - -/** -* Defines array shapes in a provided template string. -* -* @private -* @param {string} tmpl - template string -* @returns {string} updated string -*/ -function defineShapes( tmpl ) { - var i; - for ( i = 1; i < SHAPES.length; i++ ) { - tmpl = replace( tmpl, '{{NDARRAY_SHAPE_'+i+'D}}', SHAPES[ i ].join( ', ' ) ); - } - return tmpl; -} - -/** -* Creates a header file for a provided loop signature. -* -* @private -* @param {string} signature - loop signature -* @throws {Error} unexpected error -*/ -function createHeaderFile( signature ) { - var fpath; - var file; - var err; - - file = replace( TMPL_HEADER, '{{YEAR}}', CURRENT_YEAR ); - file = replace( file, '{{COPYRIGHT}}', COPYRIGHT ); - file = replace( file, '{{INCLUDE_GUARD}}', uppercase( signature ) ); - file = replace( file, '{{SIGNATURE}}', signature ); - - fpath = path.join( INCLUDE_DIR, signature+'.h' ); - - debug( 'Creating header file: %s', fpath ); - err = writeFile( fpath, file, FOPTS ); - if ( err ) { - throw err; - } -} - -/** -* Creates header files for a list of loop signatures. -* -* @private -* @param {StringArray} signatures - list of loop signatures -*/ -function createHeaderFiles( signatures ) { - var i; - for ( i = 0; i < signatures.length; i++ ) { - createHeaderFile( signatures[ i ] ); - } -} - -/** -* Creates a source file for a provided loop signature. -* -* @private -* @param {string} signature - loop signature -* @throws {Error} unexpected error -*/ -function createSourceFile( signature ) { - var match1; - var match2; - var macro; - var fpath; - var file; - var args; - var err; - var inc; - var tmp; - var ch1; - var ch2; - var ct1; - var ct2; - var nb1; - var nb2; - var t1; - var t2; - - file = replace( TMPL_SOURCE, '{{YEAR}}', CURRENT_YEAR ); - file = replace( file, '{{COPYRIGHT}}', COPYRIGHT ); - file = replace( file, '{{SIGNATURE}}', signature ); - - // Ensure the appropriate header files are included in source files: - inc = []; - if ( /c/.test( signature ) ) { - inc.push( '#include "stdlib/complex/float32/ctor.h"' ); - } - if ( /z/.test( signature ) ) { - inc.push( '#include "stdlib/complex/float64/ctor.h"' ); - } - if ( /x/.test( signature ) ) { - inc.push( '#include ' ); - } - if ( inc.length ) { - file = replace( file, '{{INCLUDES}}', '\n'+inc.join( '\n' ) ); - } else { - file = replace( file, '{{INCLUDES}}', '' ); - } - // Ensure the appropriate header files are included in source documentation examples: - inc = []; - tmp = signature.substring( 3 ); // explicit callback signature; e.g., _as_c_c, _as_z_z - if ( tmp === '' ) { - tmp = signature.substring( 0, 1 ); // implicit callback signature; e.g., c, z, d, f, etc - } - if ( /c/.test( tmp ) ) { - inc.push( '#include "stdlib/complex/float32/ctor.h"' ); - } - if ( /z/.test( tmp ) ) { - inc.push( '#include "stdlib/complex/float64/ctor.h"' ); - } - if ( /x/.test( tmp ) ) { - inc.push( '#include ' ); - } - if ( inc.length ) { - file = replace( file, '{{EXAMPLE_INCLUDES}}', '\n* '+inc.join( '\n* ' ) ); - } else { - file = replace( file, '{{EXAMPLE_INCLUDES}}', '' ); - } - // Resolve the array data types: - match1 = signature.match( RE_SIGNATURE ); - ch1 = match1[ 1 ]; - t1 = char2dtype( ch1 ); - ch2 = match1[ 2 ]; - t2 = char2dtype( ch2 ); - - // Define array data types: - file = replace( file, '{{INPUT_NDARRAY_1_DTYPE_UPPER}}', uppercase( t1 ) ); - file = replace( file, '{{OUTPUT_NDARRAY_DTYPE_UPPER}}', uppercase( t2 ) ); - - file = replace( file, '{{INPUT_NDARRAY_1_DTYPE_LOWER}}', t1 ); - file = replace( file, '{{OUTPUT_NDARRAY_DTYPE_LOWER}}', t2 ); - - // Define the input array C data type: - file = replace( file, '{{INPUT_NDARRAY_1_CTYPE}}', dtype2c( t1 ) ); - - // Define the number of bytes per element for the respective arrays: - nb1 = bytesPerElement( t1 ); - file = replace( file, '{{INPUT_NDARRAY_1_BYTES_PER_ELEMENT}}', nb1.toString() ); - - nb2 = bytesPerElement( t2 ); - file = replace( file, '{{OUTPUT_NDARRAY_BYTES_PER_ELEMENT}}', nb2.toString() ); - - // Define the array shapes: - file = defineShapes( file ); - - // Define underlying byte arrays: - file = defineByteArrays( file, nb1, nb2 ); - - // Define array strides: - file = defineStrides( file, nb1, nb2 ); - - // Resolve the callback parameter data types: - match2 = signature.match( RE_CALLBACK ); - if ( match2 ) { - ch1 = match2[ 1 ]; - ct1 = dtype2c( char2dtype( ch1 ) ); - ch2 = match2[ 2 ]; - ct2 = dtype2c( char2dtype( ch2 ) ); - } else { - ct1 = dtype2c( t1 ); - ct2 = dtype2c( t2 ); - } - file = replace( file, '{{CALLBACK_PARAM_1_DTYPE}}', ct1 ); - file = replace( file, '{{CALLBACK_RETURN_DTYPE}}', ( match2 ) ? ct2 : ct1 ); // e.g., for `f_d`, the callback signature should be `f_f` - file = replace( file, '{{CALLBACK_BODY}}', callbackBody( ch1, ( match2 ) ? ch2 : ch1 ) ); - - // Resolve the 0D callback expression: - if ( match2 ) { - if ( isComplexChar( ch1 ) ) { - if ( ch1 === ch2 ) { // e.g., c_c_as_z_z - if ( ch1 === 'z' ) { - if ( match1[ 2 ] === 'c' ) { - tmp = format( 'stdlib_complex128_to_%s( f( stdlib_complex128_from_%s( v ) ) )', t2, t1 ); - } else { - tmp = format( 'stdlib_complex128_from_%s( f( stdlib_complex128_from_%s( v ) ) )', t2, t1 ); - } - } else { // ch1 === 'c' - tmp = format( 'stdlib_complex64_from_%s( f( stdlib_complex64_from_%s( v ) ) )', t2, t1 ); - } - } else { // e.g., `c_z_as_c_z`, `z_d_as_z_d` - tmp = 'f( v )'; - } - } else if ( ch1 === ch2 ) { // e.g., `f_f_as_d_d` - tmp = format( '(%s)f( (%s)v )', dtype2c( t2 ), ct1 ); // e.g., (float)f( (double)v ) - } else { // e.g., `b_d_as_b_d`, `b_c_as_b_c` - tmp = 'f( v )'; // e.g., f( v ) - } - } else if ( /[cz]/.test( signature ) ) { - if ( ch1 === ch2 ) { // e.g., z_z, c_c - tmp = 'f( v )'; - } else if ( ch2 === 'z' ) { // e.g., c_z, d_z, u_z - tmp = format( 'stdlib_complex128_from_%s( f( v ) )', char2dtype( ch1 ) );// e.g., stdlib_complex128_from_float64( f( v ) ) - } else if ( ch2 === 'c' ) { - if ( ch1 === 'z' ) { // e.g., z_c - tmp = 'stdlib_complex128_to_complex64( f( v ) )'; - } else { // e.g., f_c - tmp = format( 'stdlib_complex64_from_%s( f( v ) )', char2dtype( ch1 ) ); - } - } else { // e.g., z_d, c_f - // Based on type promotion rules and conventions, we shouldn't reach here. - } - } else if ( ch1 === ch2 ) { // e.g., d_d, f_f, b_b - tmp = 'f( v )'; - } else { // e.g., b_d, f_d - tmp = format( '(%s)f( v )', ct2 ); // e.g., (double)f( v ) - } - file = replace( file, '{{CALLBACK_EXPRESSION_0D}}', tmp ); - - // Resolve the loop macro: - if ( match2 ) { - args = [ dtype2c( t1 ), dtype2c( t2 ) ]; - if ( isComplexChar( ch1 ) ) { - if ( ch1 === ch2 ) { - macro = MACROS.acast; // e.g., `c_c_as_z_z` - if ( ch1 === 'z' ) { - args.push( 'stdlib_complex128_from_'+t1 ); - if ( match1[ 2 ] === 'c' ) { - args.push( 'stdlib_complex128_to_'+t2 ); - } else { - args.push( 'stdlib_complex128_from_'+t2 ); - } - } else { // ch1 === 'c' - args.push( 'stdlib_complex64_from_'+t1 ); - args.push( 'stdlib_complex64_from_'+t2 ); - } - } else { - macro = MACROS.nocast; // e.g., `c_z_as_c_z`, `z_d_as_z_d` - } - } else if ( ch1 === ch2 ) { - macro = MACROS.cast; - args.push( ct1 ); - } else if ( isComplexChar( ch2 ) ) { - macro = MACROS.nocast; // e.g., `b_c_as_b_c` - } else { - macro = MACROS.default; // e.g., `b_d_as_b_d` - } - } else if ( /[cz]/.test( signature ) ) { - // E.g., z_z, c_c, c_z, f_c, d_z, u_z, #_(c|z), etc. For all these signatures, the callback signature is expected to be #_#, meaning all the same dtype (e.g., u_u). - if ( ch1 === ch2 ) { // e.g., z_z, c_c - macro = MACROS.nocast; - args = [ ct1, ct2 ]; - } else if ( ch2 === 'z' ) { // e.g., c_z, d_z, u_z - macro = MACROS.rcast; - args = [ ct1, ct2, 'stdlib_complex128_from_'+char2dtype( ch1 ) ]; - } else if ( ch2 === 'c' ) { - macro = MACROS.rcast; - args = [ ct1, ct2 ]; - if ( ch1 === 'z' ) { // e.g., z_c - args.push( 'stdlib_complex128_to_complex64' ); - } else { // e.g., f_c - args.push( 'stdlib_complex64_from_'+char2dtype( ch1 ) ); - } - } else { // e.g., z_d - macro = MACROS.default; - args = [ ct1, ct2 ]; - } - } else { - macro = MACROS.default; - args = [ ct1, ct2 ]; - } - file = replace( file, '{{LOOP_MACRO}}', macro ); - file = replace( file, '{{LOOP_MACRO_ARGUMENTS}}', args.join( ', ' ) ); - - // Create the source file: - fpath = path.join( SRC_DIR, signature+'.c' ); - debug( 'Creating source file: %s', fpath ); - err = writeFile( fpath, file, FOPTS ); - if ( err ) { - throw err; - } -} - -/** -* Creates source files for a list of loop signatures. -* -* @private -* @param {StringArray} signatures - list of loop signatures -*/ -function createSourceFiles( signatures ) { - var i; - for ( i = 0; i < signatures.length; i++ ) { - createSourceFile( signatures[ i ] ); - } -} - -/** -* Generates README documentation for a loop interface. -* -* @private -* @param {string} signature - loop signature -* @returns {string} documentation -*/ -function createDoc( signature ) { - var match; - var inc; - var doc; - var ch1; - var ch2; - var ct1; - var ct2; - var tmp; - var nb1; - var nb2; - var t1; - var t2; - - doc = replace( TMPL_README, '{{SIGNATURE}}', signature ); - - // Ensure appropriate header files are included in documentation examples: - inc = []; - tmp = signature.substring( 3 ); // explicit callback signature; e.g., _as_c_c, _as_z_z - if ( tmp === '' ) { - tmp = signature.substring( 0, 1 ); // implicit callback signature; e.g., c, z, d, f, etc - } - if ( /c/.test( tmp ) ) { - inc.push( '#include "stdlib/complex/float32/ctor.h"' ); - } - if ( /z/.test( tmp ) ) { - inc.push( '#include "stdlib/complex/float64/ctor.h"' ); - } - if ( /x/.test( tmp ) ) { - inc.push( '#include ' ); - } - if ( inc.length ) { - doc = replace( doc, '{{EXAMPLE_INCLUDES}}', '\n'+inc.join( '\n' ) ); - } else { - doc = replace( doc, '{{EXAMPLE_INCLUDES}}', '' ); - } - // Resolve the array data types: - match = signature.match( RE_SIGNATURE ); - ch1 = match[ 1 ]; - t1 = char2dtype( ch1 ); - ch2 = match[ 2 ]; - t2 = char2dtype( ch2 ); - - // Define array data types: - doc = replace( doc, '{{INPUT_NDARRAY_1_DTYPE_UPPER}}', uppercase( t1 ) ); - doc = replace( doc, '{{OUTPUT_NDARRAY_DTYPE_UPPER}}', uppercase( t2 ) ); - - // Define the number of bytes per element for the respective arrays: - nb1 = bytesPerElement( t1 ); - doc = replace( doc, '{{INPUT_NDARRAY_1_BYTES_PER_ELEMENT}}', nb1.toString() ); - - nb2 = bytesPerElement( t2 ); - doc = replace( doc, '{{OUTPUT_NDARRAY_BYTES_PER_ELEMENT}}', nb2.toString() ); - - // Define the array shapes: - doc = defineShapes( doc ); - - // Define underlying byte arrays: - doc = defineByteArrays( doc, nb1, nb2 ); - - // Define array strides: - doc = defineStrides( doc, nb1, nb2 ); - - // Resolve the callback parameter data types: - match = signature.match( RE_CALLBACK ); - if ( match ) { - ch1 = match[ 1 ]; - ct1 = dtype2c( char2dtype( ch1 ) ); - ch2 = match[ 2 ]; - ct2 = dtype2c( char2dtype( ch2 ) ); - } else { - ct1 = dtype2c( t1 ); - ct2 = dtype2c( t2 ); - } - doc = replace( doc, '{{CALLBACK_PARAM_1_DTYPE}}', ct1 ); - doc = replace( doc, '{{CALLBACK_RETURN_DTYPE}}', ( match ) ? ct2 : ct1 ); // e.g., for `f_d`, the callback signature should be `f_f` - doc = replace( doc, '{{CALLBACK_BODY}}', callbackBody( ch1, ( match ) ? ch2 : ch1 ) ); - - return doc; -} - -/** -* Returns a character code list item. -* -* @private -* @param {string} dtype - data type -* @returns {string} list item -*/ -function charCodeListItem( dtype ) { - return [ - '- **', - dtypeChar( dtype ), - '**: `', - dtype, - '` (', - dtypeDesc( dtype ), - ').' - ].join( '' ); -} - -/** -* Returns a list of character code descriptions. -* -* @private -* @param {StringArray} dtypes - list of data types -* @returns {StringArray} list of character code descriptions -*/ -function charCodeList( dtypes ) { - var out; - var i; - - out = []; - for ( i = 0; i < dtypes.length; i++ ) { - out.push( charCodeListItem( dtypes[ i ] ) ); - } - return out; -} - -/** -* Update the package README. -* -* @private -* @param {StringArray} signatures - list of (sorted) loop signatures -* @throws {Error} unexpected error -*/ -function updateREADME( signatures ) { - var parts; - var file; - var docs; - var out; - var err; - var i; - - file = readFile( README, FOPTS ); - if ( file instanceof Error ) { - throw file; - } - docs = []; - for ( i = 0; i < signatures.length; i++ ) { - docs.push( createDoc( signatures[ i ] ) ); - } - out = []; - parts = file.split( '\n' ); - out.push( parts[ 0 ] ); - out.push( '' ); - out.push( '' ); - out.push( charCodeList( DTYPES ).join( '\n' ) ); - out.push( '' ); - - parts = parts[ 1 ].split( '\n' ); - out.push( '' ); - - parts = parts[ 1 ].split( '\n' ); - out.push( parts[ 0 ] ); - out.push( '' ); - out.push( '' ); - out.push( docs.join( '\n' ) ); - - parts = parts[ 1 ].split( '\n' ); - out.push( '' ); - out.push( parts[ 1 ] ); - - err = writeFile( README, out.join( '\n' ), FOPTS ); - if ( err ) { - throw err; - } -} - -/** -* Updates the main header file. -* -* @private -* @param {StringArray} signatures - list of (sorted) loop signatures -* @throws {Error} unexpected error -*/ -function updateMainHeader( signatures ) { - var file; - var list; - var err; - var sig; - var ch; - var i; - - file = readFile( INCLUDE_MAIN, FOPTS ); - if ( file instanceof Error ) { - throw file; - } - list = []; - ch = signatures[ 0 ].charAt( 0 ); - for ( i = 0; i < signatures.length; i++ ) { - sig = signatures[ i ]; - if ( sig.charAt( 0 ) !== ch ) { - ch = sig.charAt( 0 ); - list.push( '' ); - } - list.push( '#include "unary/'+sig+'.h"' ); - } - file = [ - substringBefore( file, '\n// BEGIN LOOPS' ), - '// BEGIN LOOPS', - list.join( '\n' ), - '// END LOOPS', - substringAfter( file, '// END LOOPS\n' ) - ].join( '\n' ); - - err = writeFile( INCLUDE_MAIN, file, FOPTS ); - if ( err ) { - throw err; - } -} - -/** -* Updates the package manifest. -* -* @private -* @param {StringArray} signatures - list of (sorted) loop signatures -* @throws {Error} unexpected error -*/ -function updateManifest( signatures ) { - var file; - var list; - var tmp; - var err; - var l; - var i; - var j; - - file = readJSON( MANIFEST, FOPTS ); - if ( file instanceof Error ) { - throw file; - } - list = []; - for ( i = 0; i < signatures.length; i++ ) { - list.push( './src/'+signatures[ i ]+'.c' ); - } - for ( j = 0; j < file.confs.length; j++ ) { - l = list.slice(); - - // Copy over non-signature source files... - tmp = file.confs[ j ].src; - for ( i = 0; i < tmp.length; i++ ) { - if ( RE_MANIFEST_LOOP_FILE.test( tmp[ i ] ) === false ) { - l.push( tmp[ i ] ); - } - } - // Replace the list of source files: - file.confs[ j ].src = l; - } - err = writeFile( MANIFEST, JSON.stringify( file, null, 2 )+'\n', FOPTS ); - if ( err ) { - throw err; - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var sigs; - - debug( 'Data types: %s', DTYPES.join( ', ' ) ); - - // Generate the list of loop signatures: - sigs = signatures( DTYPES ); - debug( 'Signatures: %s', '\n'+sigs.join( '\n' ) ); - - // Remove loop files from output directories: - debug( 'Clearing include directory: %s', INCLUDE_DIR ); - removeLoopFiles( INCLUDE_DIR ); - - debug( 'Clearing source directory: %s', SRC_DIR ); - removeLoopFiles( SRC_DIR ); - - // Create header files for the list of loop signatures: - debug( 'Creating header files...' ); - createHeaderFiles( sigs ); - - // Create source files for the list of loop signatures: - debug( 'Creating source files...' ); - createSourceFiles( sigs ); - - // Update the main header file to include the loop header files: - debug( 'Updating main header file: %s', INCLUDE_MAIN ); - updateMainHeader( sigs ); - - // Update the package manifest to include the loop source files: - debug( 'Updating manifest file: %s', MANIFEST ); - updateManifest( sigs ); - - // Update the package README to include the loop interfaces: - debug( 'Updating README file: %s', README ); - updateREADME( sigs ); - - debug( 'Finished.' ); -} - -main(); diff --git a/scripts/templates/docs.txt b/scripts/templates/docs.txt deleted file mode 100644 index 81b59e4..0000000 --- a/scripts/templates/docs.txt +++ /dev/null @@ -1,89 +0,0 @@ -#### stdlib_ndarray_{{SIGNATURE}}( \*arrays\[], \*fcn ) - -Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. - -```c -#include "stdlib/ndarray/dtypes.h" -#include "stdlib/ndarray/index_modes.h" -#include "stdlib/ndarray/orders.h" -#include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -#include -#include -#include - -// Define the ndarray data types: -enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; - -// Create underlying byte arrays: -uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; -uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; - -// Define the number of dimensions: -int64_t ndims = 2; - -// Define the array shapes: -int64_t shape[] = { {{NDARRAY_SHAPE_2D}} }; - -// Define the strides: -int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; -int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; - -// Define the offsets: -int64_t ox = 0; -int64_t oy = 0; - -// Define the array order: -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[] = { imode }; -int64_t nsubmodes = 1; - -// Create an input ndarray: -struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -if ( x == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an output ndarray: -struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -if ( y == NULL ) { - fprintf( stderr, "Error allocating memory.\n" ); - exit( EXIT_FAILURE ); -} - -// Create an array containing the ndarrays: -struct ndarray *arrays[] = { x, y }; - -// Define a callback: -static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { - {{CALLBACK_BODY}} -} - -// Apply the callback: -int8_t status = stdlib_ndarray_{{SIGNATURE}}( arrays, (void *)fcn ); -if ( status != 0 ) { - fprintf( stderr, "Error during computation.\n" ); - exit( EXIT_FAILURE ); -} - -// ... - -// Free allocated memory: -stdlib_ndarray_free( x ); -stdlib_ndarray_free( y ); -``` - -The function accepts the following arguments: - -- **arrays**: `[inout] struct ndarray**` array whose first element is a pointer to an input ndarray and whose second element is a pointer to an output ndarray. -- **fcn**: `[in] void*` a `{{CALLBACK_RETURN_DTYPE}} (*f)({{CALLBACK_PARAM_1_DTYPE}})` function to apply provided as a `void` pointer. - -```c -int8_t stdlib_ndarray_{{SIGNATURE}}( struct ndarray *arrays[], void *fcn ); -``` diff --git a/scripts/templates/header.txt b/scripts/templates/header.txt deleted file mode 100644 index 3e66a36..0000000 --- a/scripts/templates/header.txt +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) {{YEAR}} {{COPYRIGHT}}. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#ifndef STDLIB_NDARRAY_BASE_UNARY_{{INCLUDE_GUARD}}_H -#define STDLIB_NDARRAY_BASE_UNARY_{{INCLUDE_GUARD}}_H - -#include "stdlib/ndarray/ctor.h" -#include - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_0d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_1d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_2d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_2d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_3d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_3d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_4d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_4d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_5d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_5d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_6d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_6d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_7d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_7d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_8d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_8d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_9d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_9d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_10d( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_10d_blocked( struct ndarray *arrays[], void *fcn ); - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_nd( struct ndarray *arrays[], void *fcn ); - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_BASE_UNARY_{{INCLUDE_GUARD}}_H diff --git a/scripts/templates/source.txt b/scripts/templates/source.txt deleted file mode 100644 index 235550b..0000000 --- a/scripts/templates/source.txt +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) {{YEAR}} {{COPYRIGHT}}. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h"{{INCLUDES}} -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_0D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_0D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_0d( struct ndarray *arrays[], void *fcn ) { - {{INPUT_NDARRAY_1_CTYPE}} v; - int8_t status = stdlib_ndarray_iget_{{INPUT_NDARRAY_1_DTYPE_LOWER}}( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_{{OUTPUT_NDARRAY_DTYPE_LOWER}}( arrays[ 1 ], 0, {{CALLBACK_EXPRESSION_0D}} ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_1D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_1D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_1D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_BYTES_PER_ELEMENT}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_BYTES_PER_ELEMENT}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_1d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_2D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_2d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_2D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_3D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_3D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_3D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_3D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_3D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_3d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_3D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_3D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_3D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_3D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_3D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_4D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_4D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_4D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_4D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_4D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_4d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_4D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_4D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_4D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_4D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_4D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_5D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_5D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_5D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_5D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_5D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_5d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_5D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_5D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_5D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_5D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_5D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_6D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_6D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_6D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_6D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_6D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_6d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_6D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_6D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_6D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_6D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_6D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_7D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_7D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_7D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_7D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_7D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_7d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_7D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_7D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_7D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_7D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_7D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_8D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_8D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_8D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_8D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_8D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_8d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_8D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_8D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_8D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_8D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_8D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_9D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_9D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_9D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_9D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_9D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_9d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_9D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_9D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_9D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_9D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_9D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_10D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_10D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_10D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_10D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_10D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_10d( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_10D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_10D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_10D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_10D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_10D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_3D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_3D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_3D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_3D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_3D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}_nd( struct ndarray *arrays[], void *fcn ) { - typedef {{CALLBACK_RETURN_DTYPE}} func_type( const {{CALLBACK_PARAM_1_DTYPE}} x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_{{LOOP_MACRO}}( {{LOOP_MACRO_ARGUMENTS}} ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_{{SIGNATURE}}_0d, - stdlib_ndarray_{{SIGNATURE}}_1d, - stdlib_ndarray_{{SIGNATURE}}_2d, - stdlib_ndarray_{{SIGNATURE}}_3d, - stdlib_ndarray_{{SIGNATURE}}_4d, - stdlib_ndarray_{{SIGNATURE}}_5d, - stdlib_ndarray_{{SIGNATURE}}_6d, - stdlib_ndarray_{{SIGNATURE}}_7d, - stdlib_ndarray_{{SIGNATURE}}_8d, - stdlib_ndarray_{{SIGNATURE}}_9d, - stdlib_ndarray_{{SIGNATURE}}_10d, - stdlib_ndarray_{{SIGNATURE}}_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_{{SIGNATURE}}_2d_blocked, - stdlib_ndarray_{{SIGNATURE}}_3d_blocked, - stdlib_ndarray_{{SIGNATURE}}_4d_blocked, - stdlib_ndarray_{{SIGNATURE}}_5d_blocked, - stdlib_ndarray_{{SIGNATURE}}_6d_blocked, - stdlib_ndarray_{{SIGNATURE}}_7d_blocked, - stdlib_ndarray_{{SIGNATURE}}_8d_blocked, - stdlib_ndarray_{{SIGNATURE}}_9d_blocked, - stdlib_ndarray_{{SIGNATURE}}_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/{{SIGNATURE}}.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h"{{EXAMPLE_INCLUDES}} -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_{{INPUT_NDARRAY_1_DTYPE_UPPER}}; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_{{OUTPUT_NDARRAY_DTYPE_UPPER}}; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { {{INPUT_NDARRAY_1_BYTES_2D}} }; -* uint8_t ybuf[] = { {{OUTPUT_NDARRAY_BYTES_2D}} }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { {{NDARRAY_SHAPE_2D}} }; -* -* // Define the strides: -* int64_t sx[] = { {{INPUT_NDARRAY_1_STRIDES_2D}} }; -* int64_t sy[] = { {{OUTPUT_NDARRAY_STRIDES_2D}} }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static {{CALLBACK_RETURN_DTYPE}} fcn( const {{CALLBACK_PARAM_1_DTYPE}} x ) { -* {{CALLBACK_BODY}} -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_{{SIGNATURE}}( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_{{SIGNATURE}}( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/README.md b/src/README.md deleted file mode 100644 index e75eff4..0000000 --- a/src/README.md +++ /dev/null @@ -1,28 +0,0 @@ - - -# Unary - -> ndarray functions for unary callbacks. - -## Notes - -- Each file contains a set of related ndarray functions. The file name matches the ndarray function name suffix for input and output ndarray dtypes. -- The implemented functions which perform conversions are **not** exhaustive and that is intentional. Namely, functions which would perform "unsafe" callback argument and return value conversions are not included (e.g., converting `double` to `int32`). If users want to perform "unsafe" conversions, that should be a conscious decision. All the machinery (e.g., macros, typedefs, etc) is available for implementing ndarray functions which perform "unsafe" conversions, but we should not make this overly easy or be proactive in promoting "unsafe" conversion use. diff --git a/src/b_b.c b/src/b_b.c deleted file mode 100644 index 17c248a..0000000 --- a/src/b_b.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_b.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint8( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, uint8_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_b_0d, - stdlib_ndarray_b_b_1d, - stdlib_ndarray_b_b_2d, - stdlib_ndarray_b_b_3d, - stdlib_ndarray_b_b_4d, - stdlib_ndarray_b_b_5d, - stdlib_ndarray_b_b_6d, - stdlib_ndarray_b_b_7d, - stdlib_ndarray_b_b_8d, - stdlib_ndarray_b_b_9d, - stdlib_ndarray_b_b_10d, - stdlib_ndarray_b_b_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_b_2d_blocked, - stdlib_ndarray_b_b_3d_blocked, - stdlib_ndarray_b_b_4d_blocked, - stdlib_ndarray_b_b_5d_blocked, - stdlib_ndarray_b_b_6d_blocked, - stdlib_ndarray_b_b_7d_blocked, - stdlib_ndarray_b_b_8d_blocked, - stdlib_ndarray_b_b_9d_blocked, - stdlib_ndarray_b_b_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_b_as_u_u.c b/src/b_b_as_u_u.c deleted file mode 100644 index cae757a..0000000 --- a/src/b_b_as_u_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint8( arrays[ 1 ], 0, (uint8_t)f( (uint32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, uint8_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_b_as_u_u_0d, - stdlib_ndarray_b_b_as_u_u_1d, - stdlib_ndarray_b_b_as_u_u_2d, - stdlib_ndarray_b_b_as_u_u_3d, - stdlib_ndarray_b_b_as_u_u_4d, - stdlib_ndarray_b_b_as_u_u_5d, - stdlib_ndarray_b_b_as_u_u_6d, - stdlib_ndarray_b_b_as_u_u_7d, - stdlib_ndarray_b_b_as_u_u_8d, - stdlib_ndarray_b_b_as_u_u_9d, - stdlib_ndarray_b_b_as_u_u_10d, - stdlib_ndarray_b_b_as_u_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_b_as_u_u_2d_blocked, - stdlib_ndarray_b_b_as_u_u_3d_blocked, - stdlib_ndarray_b_b_as_u_u_4d_blocked, - stdlib_ndarray_b_b_as_u_u_5d_blocked, - stdlib_ndarray_b_b_as_u_u_6d_blocked, - stdlib_ndarray_b_b_as_u_u_7d_blocked, - stdlib_ndarray_b_b_as_u_u_8d_blocked, - stdlib_ndarray_b_b_as_u_u_9d_blocked, - stdlib_ndarray_b_b_as_u_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_b_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_b_as_u_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_b_as_u_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_c.c b/src/b_c.c deleted file mode 100644 index e2fccea..0000000 --- a/src/b_c.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_uint8( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_c_0d, - stdlib_ndarray_b_c_1d, - stdlib_ndarray_b_c_2d, - stdlib_ndarray_b_c_3d, - stdlib_ndarray_b_c_4d, - stdlib_ndarray_b_c_5d, - stdlib_ndarray_b_c_6d, - stdlib_ndarray_b_c_7d, - stdlib_ndarray_b_c_8d, - stdlib_ndarray_b_c_9d, - stdlib_ndarray_b_c_10d, - stdlib_ndarray_b_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_c_2d_blocked, - stdlib_ndarray_b_c_3d_blocked, - stdlib_ndarray_b_c_4d_blocked, - stdlib_ndarray_b_c_5d_blocked, - stdlib_ndarray_b_c_6d_blocked, - stdlib_ndarray_b_c_7d_blocked, - stdlib_ndarray_b_c_8d_blocked, - stdlib_ndarray_b_c_9d_blocked, - stdlib_ndarray_b_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_c_as_b_c.c b/src/b_c_as_b_c.c deleted file mode 100644 index d4f017e..0000000 --- a/src/b_c_as_b_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex64_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_c_as_b_c_0d, - stdlib_ndarray_b_c_as_b_c_1d, - stdlib_ndarray_b_c_as_b_c_2d, - stdlib_ndarray_b_c_as_b_c_3d, - stdlib_ndarray_b_c_as_b_c_4d, - stdlib_ndarray_b_c_as_b_c_5d, - stdlib_ndarray_b_c_as_b_c_6d, - stdlib_ndarray_b_c_as_b_c_7d, - stdlib_ndarray_b_c_as_b_c_8d, - stdlib_ndarray_b_c_as_b_c_9d, - stdlib_ndarray_b_c_as_b_c_10d, - stdlib_ndarray_b_c_as_b_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_c_as_b_c_2d_blocked, - stdlib_ndarray_b_c_as_b_c_3d_blocked, - stdlib_ndarray_b_c_as_b_c_4d_blocked, - stdlib_ndarray_b_c_as_b_c_5d_blocked, - stdlib_ndarray_b_c_as_b_c_6d_blocked, - stdlib_ndarray_b_c_as_b_c_7d_blocked, - stdlib_ndarray_b_c_as_b_c_8d_blocked, - stdlib_ndarray_b_c_as_b_c_9d_blocked, - stdlib_ndarray_b_c_as_b_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_b_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_b_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_b_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_c_as_c_c.c b/src/b_c_as_c_c.c deleted file mode 100644 index 6189a3f..0000000 --- a/src/b_c_as_c_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_complex64( f( stdlib_complex64_from_uint8( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex64_from_uint8, stdlib_complex64_from_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_c_as_c_c_0d, - stdlib_ndarray_b_c_as_c_c_1d, - stdlib_ndarray_b_c_as_c_c_2d, - stdlib_ndarray_b_c_as_c_c_3d, - stdlib_ndarray_b_c_as_c_c_4d, - stdlib_ndarray_b_c_as_c_c_5d, - stdlib_ndarray_b_c_as_c_c_6d, - stdlib_ndarray_b_c_as_c_c_7d, - stdlib_ndarray_b_c_as_c_c_8d, - stdlib_ndarray_b_c_as_c_c_9d, - stdlib_ndarray_b_c_as_c_c_10d, - stdlib_ndarray_b_c_as_c_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_c_as_c_c_2d_blocked, - stdlib_ndarray_b_c_as_c_c_3d_blocked, - stdlib_ndarray_b_c_as_c_c_4d_blocked, - stdlib_ndarray_b_c_as_c_c_5d_blocked, - stdlib_ndarray_b_c_as_c_c_6d_blocked, - stdlib_ndarray_b_c_as_c_c_7d_blocked, - stdlib_ndarray_b_c_as_c_c_8d_blocked, - stdlib_ndarray_b_c_as_c_c_9d_blocked, - stdlib_ndarray_b_c_as_c_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_c_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_c_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_c_as_z_z.c b/src/b_c_as_z_z.c deleted file mode 100644 index 4423a58..0000000 --- a/src/b_c_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex128_to_complex64( f( stdlib_complex128_from_uint8( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex64_t, stdlib_complex128_from_uint8, stdlib_complex128_to_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_c_as_z_z_0d, - stdlib_ndarray_b_c_as_z_z_1d, - stdlib_ndarray_b_c_as_z_z_2d, - stdlib_ndarray_b_c_as_z_z_3d, - stdlib_ndarray_b_c_as_z_z_4d, - stdlib_ndarray_b_c_as_z_z_5d, - stdlib_ndarray_b_c_as_z_z_6d, - stdlib_ndarray_b_c_as_z_z_7d, - stdlib_ndarray_b_c_as_z_z_8d, - stdlib_ndarray_b_c_as_z_z_9d, - stdlib_ndarray_b_c_as_z_z_10d, - stdlib_ndarray_b_c_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_c_as_z_z_2d_blocked, - stdlib_ndarray_b_c_as_z_z_3d_blocked, - stdlib_ndarray_b_c_as_z_z_4d_blocked, - stdlib_ndarray_b_c_as_z_z_5d_blocked, - stdlib_ndarray_b_c_as_z_z_6d_blocked, - stdlib_ndarray_b_c_as_z_z_7d_blocked, - stdlib_ndarray_b_c_as_z_z_8d_blocked, - stdlib_ndarray_b_c_as_z_z_9d_blocked, - stdlib_ndarray_b_c_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_c_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_c_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_d.c b/src/b_d.c deleted file mode 100644 index 3b2d203..0000000 --- a/src/b_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_d_0d, - stdlib_ndarray_b_d_1d, - stdlib_ndarray_b_d_2d, - stdlib_ndarray_b_d_3d, - stdlib_ndarray_b_d_4d, - stdlib_ndarray_b_d_5d, - stdlib_ndarray_b_d_6d, - stdlib_ndarray_b_d_7d, - stdlib_ndarray_b_d_8d, - stdlib_ndarray_b_d_9d, - stdlib_ndarray_b_d_10d, - stdlib_ndarray_b_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_d_2d_blocked, - stdlib_ndarray_b_d_3d_blocked, - stdlib_ndarray_b_d_4d_blocked, - stdlib_ndarray_b_d_5d_blocked, - stdlib_ndarray_b_d_6d_blocked, - stdlib_ndarray_b_d_7d_blocked, - stdlib_ndarray_b_d_8d_blocked, - stdlib_ndarray_b_d_9d_blocked, - stdlib_ndarray_b_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_d_as_b_d.c b/src/b_d_as_b_d.c deleted file mode 100644 index 31530a5..0000000 --- a/src/b_d_as_b_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_d_as_b_d_0d, - stdlib_ndarray_b_d_as_b_d_1d, - stdlib_ndarray_b_d_as_b_d_2d, - stdlib_ndarray_b_d_as_b_d_3d, - stdlib_ndarray_b_d_as_b_d_4d, - stdlib_ndarray_b_d_as_b_d_5d, - stdlib_ndarray_b_d_as_b_d_6d, - stdlib_ndarray_b_d_as_b_d_7d, - stdlib_ndarray_b_d_as_b_d_8d, - stdlib_ndarray_b_d_as_b_d_9d, - stdlib_ndarray_b_d_as_b_d_10d, - stdlib_ndarray_b_d_as_b_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_d_as_b_d_2d_blocked, - stdlib_ndarray_b_d_as_b_d_3d_blocked, - stdlib_ndarray_b_d_as_b_d_4d_blocked, - stdlib_ndarray_b_d_as_b_d_5d_blocked, - stdlib_ndarray_b_d_as_b_d_6d_blocked, - stdlib_ndarray_b_d_as_b_d_7d_blocked, - stdlib_ndarray_b_d_as_b_d_8d_blocked, - stdlib_ndarray_b_d_as_b_d_9d_blocked, - stdlib_ndarray_b_d_as_b_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_b_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_b_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_b_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_d_as_d_d.c b/src/b_d_as_d_d.c deleted file mode 100644 index b818c32..0000000 --- a/src/b_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_d_as_d_d_0d, - stdlib_ndarray_b_d_as_d_d_1d, - stdlib_ndarray_b_d_as_d_d_2d, - stdlib_ndarray_b_d_as_d_d_3d, - stdlib_ndarray_b_d_as_d_d_4d, - stdlib_ndarray_b_d_as_d_d_5d, - stdlib_ndarray_b_d_as_d_d_6d, - stdlib_ndarray_b_d_as_d_d_7d, - stdlib_ndarray_b_d_as_d_d_8d, - stdlib_ndarray_b_d_as_d_d_9d, - stdlib_ndarray_b_d_as_d_d_10d, - stdlib_ndarray_b_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_d_as_d_d_2d_blocked, - stdlib_ndarray_b_d_as_d_d_3d_blocked, - stdlib_ndarray_b_d_as_d_d_4d_blocked, - stdlib_ndarray_b_d_as_d_d_5d_blocked, - stdlib_ndarray_b_d_as_d_d_6d_blocked, - stdlib_ndarray_b_d_as_d_d_7d_blocked, - stdlib_ndarray_b_d_as_d_d_8d_blocked, - stdlib_ndarray_b_d_as_d_d_9d_blocked, - stdlib_ndarray_b_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_f.c b/src/b_f.c deleted file mode 100644 index 410f244..0000000 --- a/src/b_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_f_0d, - stdlib_ndarray_b_f_1d, - stdlib_ndarray_b_f_2d, - stdlib_ndarray_b_f_3d, - stdlib_ndarray_b_f_4d, - stdlib_ndarray_b_f_5d, - stdlib_ndarray_b_f_6d, - stdlib_ndarray_b_f_7d, - stdlib_ndarray_b_f_8d, - stdlib_ndarray_b_f_9d, - stdlib_ndarray_b_f_10d, - stdlib_ndarray_b_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_f_2d_blocked, - stdlib_ndarray_b_f_3d_blocked, - stdlib_ndarray_b_f_4d_blocked, - stdlib_ndarray_b_f_5d_blocked, - stdlib_ndarray_b_f_6d_blocked, - stdlib_ndarray_b_f_7d_blocked, - stdlib_ndarray_b_f_8d_blocked, - stdlib_ndarray_b_f_9d_blocked, - stdlib_ndarray_b_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_f_as_b_f.c b/src/b_f_as_b_f.c deleted file mode 100644 index 01cee0e..0000000 --- a/src/b_f_as_b_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_f_as_b_f_0d, - stdlib_ndarray_b_f_as_b_f_1d, - stdlib_ndarray_b_f_as_b_f_2d, - stdlib_ndarray_b_f_as_b_f_3d, - stdlib_ndarray_b_f_as_b_f_4d, - stdlib_ndarray_b_f_as_b_f_5d, - stdlib_ndarray_b_f_as_b_f_6d, - stdlib_ndarray_b_f_as_b_f_7d, - stdlib_ndarray_b_f_as_b_f_8d, - stdlib_ndarray_b_f_as_b_f_9d, - stdlib_ndarray_b_f_as_b_f_10d, - stdlib_ndarray_b_f_as_b_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_f_as_b_f_2d_blocked, - stdlib_ndarray_b_f_as_b_f_3d_blocked, - stdlib_ndarray_b_f_as_b_f_4d_blocked, - stdlib_ndarray_b_f_as_b_f_5d_blocked, - stdlib_ndarray_b_f_as_b_f_6d_blocked, - stdlib_ndarray_b_f_as_b_f_7d_blocked, - stdlib_ndarray_b_f_as_b_f_8d_blocked, - stdlib_ndarray_b_f_as_b_f_9d_blocked, - stdlib_ndarray_b_f_as_b_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_b_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_b_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_b_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_f_as_d_d.c b/src/b_f_as_d_d.c deleted file mode 100644 index 1f8d26c..0000000 --- a/src/b_f_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_f_as_d_d_0d, - stdlib_ndarray_b_f_as_d_d_1d, - stdlib_ndarray_b_f_as_d_d_2d, - stdlib_ndarray_b_f_as_d_d_3d, - stdlib_ndarray_b_f_as_d_d_4d, - stdlib_ndarray_b_f_as_d_d_5d, - stdlib_ndarray_b_f_as_d_d_6d, - stdlib_ndarray_b_f_as_d_d_7d, - stdlib_ndarray_b_f_as_d_d_8d, - stdlib_ndarray_b_f_as_d_d_9d, - stdlib_ndarray_b_f_as_d_d_10d, - stdlib_ndarray_b_f_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_f_as_d_d_2d_blocked, - stdlib_ndarray_b_f_as_d_d_3d_blocked, - stdlib_ndarray_b_f_as_d_d_4d_blocked, - stdlib_ndarray_b_f_as_d_d_5d_blocked, - stdlib_ndarray_b_f_as_d_d_6d_blocked, - stdlib_ndarray_b_f_as_d_d_7d_blocked, - stdlib_ndarray_b_f_as_d_d_8d_blocked, - stdlib_ndarray_b_f_as_d_d_9d_blocked, - stdlib_ndarray_b_f_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_f_as_f_f.c b/src/b_f_as_f_f.c deleted file mode 100644 index 5e88b96..0000000 --- a/src/b_f_as_f_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (float)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, float, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_f_as_f_f_0d, - stdlib_ndarray_b_f_as_f_f_1d, - stdlib_ndarray_b_f_as_f_f_2d, - stdlib_ndarray_b_f_as_f_f_3d, - stdlib_ndarray_b_f_as_f_f_4d, - stdlib_ndarray_b_f_as_f_f_5d, - stdlib_ndarray_b_f_as_f_f_6d, - stdlib_ndarray_b_f_as_f_f_7d, - stdlib_ndarray_b_f_as_f_f_8d, - stdlib_ndarray_b_f_as_f_f_9d, - stdlib_ndarray_b_f_as_f_f_10d, - stdlib_ndarray_b_f_as_f_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_f_as_f_f_2d_blocked, - stdlib_ndarray_b_f_as_f_f_3d_blocked, - stdlib_ndarray_b_f_as_f_f_4d_blocked, - stdlib_ndarray_b_f_as_f_f_5d_blocked, - stdlib_ndarray_b_f_as_f_f_6d_blocked, - stdlib_ndarray_b_f_as_f_f_7d_blocked, - stdlib_ndarray_b_f_as_f_f_8d_blocked, - stdlib_ndarray_b_f_as_f_f_9d_blocked, - stdlib_ndarray_b_f_as_f_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_f_as_f_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_f_as_f_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_i.c b/src/b_i.c deleted file mode 100644 index 10dc329..0000000 --- a/src/b_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_i_0d, - stdlib_ndarray_b_i_1d, - stdlib_ndarray_b_i_2d, - stdlib_ndarray_b_i_3d, - stdlib_ndarray_b_i_4d, - stdlib_ndarray_b_i_5d, - stdlib_ndarray_b_i_6d, - stdlib_ndarray_b_i_7d, - stdlib_ndarray_b_i_8d, - stdlib_ndarray_b_i_9d, - stdlib_ndarray_b_i_10d, - stdlib_ndarray_b_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_i_2d_blocked, - stdlib_ndarray_b_i_3d_blocked, - stdlib_ndarray_b_i_4d_blocked, - stdlib_ndarray_b_i_5d_blocked, - stdlib_ndarray_b_i_6d_blocked, - stdlib_ndarray_b_i_7d_blocked, - stdlib_ndarray_b_i_8d_blocked, - stdlib_ndarray_b_i_9d_blocked, - stdlib_ndarray_b_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_i_as_b_i.c b/src/b_i_as_b_i.c deleted file mode 100644 index c660d83..0000000 --- a/src/b_i_as_b_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_i_as_b_i_0d, - stdlib_ndarray_b_i_as_b_i_1d, - stdlib_ndarray_b_i_as_b_i_2d, - stdlib_ndarray_b_i_as_b_i_3d, - stdlib_ndarray_b_i_as_b_i_4d, - stdlib_ndarray_b_i_as_b_i_5d, - stdlib_ndarray_b_i_as_b_i_6d, - stdlib_ndarray_b_i_as_b_i_7d, - stdlib_ndarray_b_i_as_b_i_8d, - stdlib_ndarray_b_i_as_b_i_9d, - stdlib_ndarray_b_i_as_b_i_10d, - stdlib_ndarray_b_i_as_b_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_i_as_b_i_2d_blocked, - stdlib_ndarray_b_i_as_b_i_3d_blocked, - stdlib_ndarray_b_i_as_b_i_4d_blocked, - stdlib_ndarray_b_i_as_b_i_5d_blocked, - stdlib_ndarray_b_i_as_b_i_6d_blocked, - stdlib_ndarray_b_i_as_b_i_7d_blocked, - stdlib_ndarray_b_i_as_b_i_8d_blocked, - stdlib_ndarray_b_i_as_b_i_9d_blocked, - stdlib_ndarray_b_i_as_b_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_b_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_b_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_b_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_i_as_i_i.c b/src/b_i_as_i_i.c deleted file mode 100644 index 3e99e5e..0000000 --- a/src/b_i_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, int32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_i_as_i_i_0d, - stdlib_ndarray_b_i_as_i_i_1d, - stdlib_ndarray_b_i_as_i_i_2d, - stdlib_ndarray_b_i_as_i_i_3d, - stdlib_ndarray_b_i_as_i_i_4d, - stdlib_ndarray_b_i_as_i_i_5d, - stdlib_ndarray_b_i_as_i_i_6d, - stdlib_ndarray_b_i_as_i_i_7d, - stdlib_ndarray_b_i_as_i_i_8d, - stdlib_ndarray_b_i_as_i_i_9d, - stdlib_ndarray_b_i_as_i_i_10d, - stdlib_ndarray_b_i_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_i_as_i_i_2d_blocked, - stdlib_ndarray_b_i_as_i_i_3d_blocked, - stdlib_ndarray_b_i_as_i_i_4d_blocked, - stdlib_ndarray_b_i_as_i_i_5d_blocked, - stdlib_ndarray_b_i_as_i_i_6d_blocked, - stdlib_ndarray_b_i_as_i_i_7d_blocked, - stdlib_ndarray_b_i_as_i_i_8d_blocked, - stdlib_ndarray_b_i_as_i_i_9d_blocked, - stdlib_ndarray_b_i_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_i_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_i_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_k.c b/src/b_k.c deleted file mode 100644 index 69ff108..0000000 --- a/src/b_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_k_0d, - stdlib_ndarray_b_k_1d, - stdlib_ndarray_b_k_2d, - stdlib_ndarray_b_k_3d, - stdlib_ndarray_b_k_4d, - stdlib_ndarray_b_k_5d, - stdlib_ndarray_b_k_6d, - stdlib_ndarray_b_k_7d, - stdlib_ndarray_b_k_8d, - stdlib_ndarray_b_k_9d, - stdlib_ndarray_b_k_10d, - stdlib_ndarray_b_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_k_2d_blocked, - stdlib_ndarray_b_k_3d_blocked, - stdlib_ndarray_b_k_4d_blocked, - stdlib_ndarray_b_k_5d_blocked, - stdlib_ndarray_b_k_6d_blocked, - stdlib_ndarray_b_k_7d_blocked, - stdlib_ndarray_b_k_8d_blocked, - stdlib_ndarray_b_k_9d_blocked, - stdlib_ndarray_b_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_k_as_b_k.c b/src/b_k_as_b_k.c deleted file mode 100644 index ce44db0..0000000 --- a/src/b_k_as_b_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_k_as_b_k_0d, - stdlib_ndarray_b_k_as_b_k_1d, - stdlib_ndarray_b_k_as_b_k_2d, - stdlib_ndarray_b_k_as_b_k_3d, - stdlib_ndarray_b_k_as_b_k_4d, - stdlib_ndarray_b_k_as_b_k_5d, - stdlib_ndarray_b_k_as_b_k_6d, - stdlib_ndarray_b_k_as_b_k_7d, - stdlib_ndarray_b_k_as_b_k_8d, - stdlib_ndarray_b_k_as_b_k_9d, - stdlib_ndarray_b_k_as_b_k_10d, - stdlib_ndarray_b_k_as_b_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_k_as_b_k_2d_blocked, - stdlib_ndarray_b_k_as_b_k_3d_blocked, - stdlib_ndarray_b_k_as_b_k_4d_blocked, - stdlib_ndarray_b_k_as_b_k_5d_blocked, - stdlib_ndarray_b_k_as_b_k_6d_blocked, - stdlib_ndarray_b_k_as_b_k_7d_blocked, - stdlib_ndarray_b_k_as_b_k_8d_blocked, - stdlib_ndarray_b_k_as_b_k_9d_blocked, - stdlib_ndarray_b_k_as_b_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_b_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_b_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_b_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_k_as_i_i.c b/src/b_k_as_i_i.c deleted file mode 100644 index c367bef..0000000 --- a/src/b_k_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_k_as_i_i_0d, - stdlib_ndarray_b_k_as_i_i_1d, - stdlib_ndarray_b_k_as_i_i_2d, - stdlib_ndarray_b_k_as_i_i_3d, - stdlib_ndarray_b_k_as_i_i_4d, - stdlib_ndarray_b_k_as_i_i_5d, - stdlib_ndarray_b_k_as_i_i_6d, - stdlib_ndarray_b_k_as_i_i_7d, - stdlib_ndarray_b_k_as_i_i_8d, - stdlib_ndarray_b_k_as_i_i_9d, - stdlib_ndarray_b_k_as_i_i_10d, - stdlib_ndarray_b_k_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_k_as_i_i_2d_blocked, - stdlib_ndarray_b_k_as_i_i_3d_blocked, - stdlib_ndarray_b_k_as_i_i_4d_blocked, - stdlib_ndarray_b_k_as_i_i_5d_blocked, - stdlib_ndarray_b_k_as_i_i_6d_blocked, - stdlib_ndarray_b_k_as_i_i_7d_blocked, - stdlib_ndarray_b_k_as_i_i_8d_blocked, - stdlib_ndarray_b_k_as_i_i_9d_blocked, - stdlib_ndarray_b_k_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_k_as_k_k.c b/src/b_k_as_k_k.c deleted file mode 100644 index 7c1dbed..0000000 --- a/src/b_k_as_k_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( (int16_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, int16_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_k_as_k_k_0d, - stdlib_ndarray_b_k_as_k_k_1d, - stdlib_ndarray_b_k_as_k_k_2d, - stdlib_ndarray_b_k_as_k_k_3d, - stdlib_ndarray_b_k_as_k_k_4d, - stdlib_ndarray_b_k_as_k_k_5d, - stdlib_ndarray_b_k_as_k_k_6d, - stdlib_ndarray_b_k_as_k_k_7d, - stdlib_ndarray_b_k_as_k_k_8d, - stdlib_ndarray_b_k_as_k_k_9d, - stdlib_ndarray_b_k_as_k_k_10d, - stdlib_ndarray_b_k_as_k_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_k_as_k_k_2d_blocked, - stdlib_ndarray_b_k_as_k_k_3d_blocked, - stdlib_ndarray_b_k_as_k_k_4d_blocked, - stdlib_ndarray_b_k_as_k_k_5d_blocked, - stdlib_ndarray_b_k_as_k_k_6d_blocked, - stdlib_ndarray_b_k_as_k_k_7d_blocked, - stdlib_ndarray_b_k_as_k_k_8d_blocked, - stdlib_ndarray_b_k_as_k_k_9d_blocked, - stdlib_ndarray_b_k_as_k_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_k_as_k_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_k_as_k_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_t.c b/src/b_t.c deleted file mode 100644 index 222acfa..0000000 --- a/src/b_t.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_t.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_t_0d, - stdlib_ndarray_b_t_1d, - stdlib_ndarray_b_t_2d, - stdlib_ndarray_b_t_3d, - stdlib_ndarray_b_t_4d, - stdlib_ndarray_b_t_5d, - stdlib_ndarray_b_t_6d, - stdlib_ndarray_b_t_7d, - stdlib_ndarray_b_t_8d, - stdlib_ndarray_b_t_9d, - stdlib_ndarray_b_t_10d, - stdlib_ndarray_b_t_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_t_2d_blocked, - stdlib_ndarray_b_t_3d_blocked, - stdlib_ndarray_b_t_4d_blocked, - stdlib_ndarray_b_t_5d_blocked, - stdlib_ndarray_b_t_6d_blocked, - stdlib_ndarray_b_t_7d_blocked, - stdlib_ndarray_b_t_8d_blocked, - stdlib_ndarray_b_t_9d_blocked, - stdlib_ndarray_b_t_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_t_as_b_t.c b/src/b_t_as_b_t.c deleted file mode 100644 index 74a81f1..0000000 --- a/src/b_t_as_b_t.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, uint16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_t_as_b_t_0d, - stdlib_ndarray_b_t_as_b_t_1d, - stdlib_ndarray_b_t_as_b_t_2d, - stdlib_ndarray_b_t_as_b_t_3d, - stdlib_ndarray_b_t_as_b_t_4d, - stdlib_ndarray_b_t_as_b_t_5d, - stdlib_ndarray_b_t_as_b_t_6d, - stdlib_ndarray_b_t_as_b_t_7d, - stdlib_ndarray_b_t_as_b_t_8d, - stdlib_ndarray_b_t_as_b_t_9d, - stdlib_ndarray_b_t_as_b_t_10d, - stdlib_ndarray_b_t_as_b_t_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_t_as_b_t_2d_blocked, - stdlib_ndarray_b_t_as_b_t_3d_blocked, - stdlib_ndarray_b_t_as_b_t_4d_blocked, - stdlib_ndarray_b_t_as_b_t_5d_blocked, - stdlib_ndarray_b_t_as_b_t_6d_blocked, - stdlib_ndarray_b_t_as_b_t_7d_blocked, - stdlib_ndarray_b_t_as_b_t_8d_blocked, - stdlib_ndarray_b_t_as_b_t_9d_blocked, - stdlib_ndarray_b_t_as_b_t_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_b_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_b_t( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_b_t( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_t_as_t_t.c b/src/b_t_as_t_t.c deleted file mode 100644 index 88902a4..0000000 --- a/src/b_t_as_t_t.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( (uint16_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_t_as_t_t_0d, - stdlib_ndarray_b_t_as_t_t_1d, - stdlib_ndarray_b_t_as_t_t_2d, - stdlib_ndarray_b_t_as_t_t_3d, - stdlib_ndarray_b_t_as_t_t_4d, - stdlib_ndarray_b_t_as_t_t_5d, - stdlib_ndarray_b_t_as_t_t_6d, - stdlib_ndarray_b_t_as_t_t_7d, - stdlib_ndarray_b_t_as_t_t_8d, - stdlib_ndarray_b_t_as_t_t_9d, - stdlib_ndarray_b_t_as_t_t_10d, - stdlib_ndarray_b_t_as_t_t_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_t_as_t_t_2d_blocked, - stdlib_ndarray_b_t_as_t_t_3d_blocked, - stdlib_ndarray_b_t_as_t_t_4d_blocked, - stdlib_ndarray_b_t_as_t_t_5d_blocked, - stdlib_ndarray_b_t_as_t_t_6d_blocked, - stdlib_ndarray_b_t_as_t_t_7d_blocked, - stdlib_ndarray_b_t_as_t_t_8d_blocked, - stdlib_ndarray_b_t_as_t_t_9d_blocked, - stdlib_ndarray_b_t_as_t_t_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_t_t( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_t_t( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_t_as_u_u.c b/src/b_t_as_u_u.c deleted file mode 100644 index 4644dc1..0000000 --- a/src/b_t_as_u_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( (uint32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, uint16_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_t_as_u_u_0d, - stdlib_ndarray_b_t_as_u_u_1d, - stdlib_ndarray_b_t_as_u_u_2d, - stdlib_ndarray_b_t_as_u_u_3d, - stdlib_ndarray_b_t_as_u_u_4d, - stdlib_ndarray_b_t_as_u_u_5d, - stdlib_ndarray_b_t_as_u_u_6d, - stdlib_ndarray_b_t_as_u_u_7d, - stdlib_ndarray_b_t_as_u_u_8d, - stdlib_ndarray_b_t_as_u_u_9d, - stdlib_ndarray_b_t_as_u_u_10d, - stdlib_ndarray_b_t_as_u_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_t_as_u_u_2d_blocked, - stdlib_ndarray_b_t_as_u_u_3d_blocked, - stdlib_ndarray_b_t_as_u_u_4d_blocked, - stdlib_ndarray_b_t_as_u_u_5d_blocked, - stdlib_ndarray_b_t_as_u_u_6d_blocked, - stdlib_ndarray_b_t_as_u_u_7d_blocked, - stdlib_ndarray_b_t_as_u_u_8d_blocked, - stdlib_ndarray_b_t_as_u_u_9d_blocked, - stdlib_ndarray_b_t_as_u_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_t_as_u_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_t_as_u_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_u.c b/src/b_u.c deleted file mode 100644 index dba9915..0000000 --- a/src/b_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_u_0d, - stdlib_ndarray_b_u_1d, - stdlib_ndarray_b_u_2d, - stdlib_ndarray_b_u_3d, - stdlib_ndarray_b_u_4d, - stdlib_ndarray_b_u_5d, - stdlib_ndarray_b_u_6d, - stdlib_ndarray_b_u_7d, - stdlib_ndarray_b_u_8d, - stdlib_ndarray_b_u_9d, - stdlib_ndarray_b_u_10d, - stdlib_ndarray_b_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_u_2d_blocked, - stdlib_ndarray_b_u_3d_blocked, - stdlib_ndarray_b_u_4d_blocked, - stdlib_ndarray_b_u_5d_blocked, - stdlib_ndarray_b_u_6d_blocked, - stdlib_ndarray_b_u_7d_blocked, - stdlib_ndarray_b_u_8d_blocked, - stdlib_ndarray_b_u_9d_blocked, - stdlib_ndarray_b_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_u_as_b_u.c b/src/b_u_as_b_u.c deleted file mode 100644 index 3d65023..0000000 --- a/src/b_u_as_b_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint8_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_u_as_b_u_0d, - stdlib_ndarray_b_u_as_b_u_1d, - stdlib_ndarray_b_u_as_b_u_2d, - stdlib_ndarray_b_u_as_b_u_3d, - stdlib_ndarray_b_u_as_b_u_4d, - stdlib_ndarray_b_u_as_b_u_5d, - stdlib_ndarray_b_u_as_b_u_6d, - stdlib_ndarray_b_u_as_b_u_7d, - stdlib_ndarray_b_u_as_b_u_8d, - stdlib_ndarray_b_u_as_b_u_9d, - stdlib_ndarray_b_u_as_b_u_10d, - stdlib_ndarray_b_u_as_b_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_u_as_b_u_2d_blocked, - stdlib_ndarray_b_u_as_b_u_3d_blocked, - stdlib_ndarray_b_u_as_b_u_4d_blocked, - stdlib_ndarray_b_u_as_b_u_5d_blocked, - stdlib_ndarray_b_u_as_b_u_6d_blocked, - stdlib_ndarray_b_u_as_b_u_7d_blocked, - stdlib_ndarray_b_u_as_b_u_8d_blocked, - stdlib_ndarray_b_u_as_b_u_9d_blocked, - stdlib_ndarray_b_u_as_b_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_b_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_b_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_b_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_u_as_u_u.c b/src/b_u_as_u_u.c deleted file mode 100644 index a5d978a..0000000 --- a/src/b_u_as_u_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( (uint32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint8_t, uint32_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_u_as_u_u_0d, - stdlib_ndarray_b_u_as_u_u_1d, - stdlib_ndarray_b_u_as_u_u_2d, - stdlib_ndarray_b_u_as_u_u_3d, - stdlib_ndarray_b_u_as_u_u_4d, - stdlib_ndarray_b_u_as_u_u_5d, - stdlib_ndarray_b_u_as_u_u_6d, - stdlib_ndarray_b_u_as_u_u_7d, - stdlib_ndarray_b_u_as_u_u_8d, - stdlib_ndarray_b_u_as_u_u_9d, - stdlib_ndarray_b_u_as_u_u_10d, - stdlib_ndarray_b_u_as_u_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_u_as_u_u_2d_blocked, - stdlib_ndarray_b_u_as_u_u_3d_blocked, - stdlib_ndarray_b_u_as_u_u_4d_blocked, - stdlib_ndarray_b_u_as_u_u_5d_blocked, - stdlib_ndarray_b_u_as_u_u_6d_blocked, - stdlib_ndarray_b_u_as_u_u_7d_blocked, - stdlib_ndarray_b_u_as_u_u_8d_blocked, - stdlib_ndarray_b_u_as_u_u_9d_blocked, - stdlib_ndarray_b_u_as_u_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_u_as_u_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_u_as_u_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_z.c b/src/b_z.c deleted file mode 100644 index edb31c9..0000000 --- a/src/b_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_uint8( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint8_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_z_0d, - stdlib_ndarray_b_z_1d, - stdlib_ndarray_b_z_2d, - stdlib_ndarray_b_z_3d, - stdlib_ndarray_b_z_4d, - stdlib_ndarray_b_z_5d, - stdlib_ndarray_b_z_6d, - stdlib_ndarray_b_z_7d, - stdlib_ndarray_b_z_8d, - stdlib_ndarray_b_z_9d, - stdlib_ndarray_b_z_10d, - stdlib_ndarray_b_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_z_2d_blocked, - stdlib_ndarray_b_z_3d_blocked, - stdlib_ndarray_b_z_4d_blocked, - stdlib_ndarray_b_z_5d_blocked, - stdlib_ndarray_b_z_6d_blocked, - stdlib_ndarray_b_z_7d_blocked, - stdlib_ndarray_b_z_8d_blocked, - stdlib_ndarray_b_z_9d_blocked, - stdlib_ndarray_b_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint8_t fcn( const uint8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_z_as_b_z.c b/src/b_z_as_b_z.c deleted file mode 100644 index 32b1cd2..0000000 --- a/src/b_z_as_b_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( uint8_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_z_as_b_z_0d, - stdlib_ndarray_b_z_as_b_z_1d, - stdlib_ndarray_b_z_as_b_z_2d, - stdlib_ndarray_b_z_as_b_z_3d, - stdlib_ndarray_b_z_as_b_z_4d, - stdlib_ndarray_b_z_as_b_z_5d, - stdlib_ndarray_b_z_as_b_z_6d, - stdlib_ndarray_b_z_as_b_z_7d, - stdlib_ndarray_b_z_as_b_z_8d, - stdlib_ndarray_b_z_as_b_z_9d, - stdlib_ndarray_b_z_as_b_z_10d, - stdlib_ndarray_b_z_as_b_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_z_as_b_z_2d_blocked, - stdlib_ndarray_b_z_as_b_z_3d_blocked, - stdlib_ndarray_b_z_as_b_z_4d_blocked, - stdlib_ndarray_b_z_as_b_z_5d_blocked, - stdlib_ndarray_b_z_as_b_z_6d_blocked, - stdlib_ndarray_b_z_as_b_z_7d_blocked, - stdlib_ndarray_b_z_as_b_z_8d_blocked, - stdlib_ndarray_b_z_as_b_z_9d_blocked, - stdlib_ndarray_b_z_as_b_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_b_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_b_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_b_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/b_z_as_z_z.c b/src/b_z_as_z_z.c deleted file mode 100644 index 80b398b..0000000 --- a/src/b_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - uint8_t v; - int8_t status = stdlib_ndarray_iget_uint8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_uint8( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint8_t, stdlib_complex128_t, stdlib_complex128_from_uint8, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_b_z_as_z_z_0d, - stdlib_ndarray_b_z_as_z_z_1d, - stdlib_ndarray_b_z_as_z_z_2d, - stdlib_ndarray_b_z_as_z_z_3d, - stdlib_ndarray_b_z_as_z_z_4d, - stdlib_ndarray_b_z_as_z_z_5d, - stdlib_ndarray_b_z_as_z_z_6d, - stdlib_ndarray_b_z_as_z_z_7d, - stdlib_ndarray_b_z_as_z_z_8d, - stdlib_ndarray_b_z_as_z_z_9d, - stdlib_ndarray_b_z_as_z_z_10d, - stdlib_ndarray_b_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_b_z_as_z_z_2d_blocked, - stdlib_ndarray_b_z_as_z_z_3d_blocked, - stdlib_ndarray_b_z_as_z_z_4d_blocked, - stdlib_ndarray_b_z_as_z_z_5d_blocked, - stdlib_ndarray_b_z_as_z_z_6d_blocked, - stdlib_ndarray_b_z_as_z_z_7d_blocked, - stdlib_ndarray_b_z_as_z_z_8d_blocked, - stdlib_ndarray_b_z_as_z_z_9d_blocked, - stdlib_ndarray_b_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/b_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_b_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_b_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/c_c.c b/src/c_c.c deleted file mode 100644 index c550fa4..0000000 --- a/src/c_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/c_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex64_t v; - int8_t status = stdlib_ndarray_iget_complex64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex64_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_c_c_0d, - stdlib_ndarray_c_c_1d, - stdlib_ndarray_c_c_2d, - stdlib_ndarray_c_c_3d, - stdlib_ndarray_c_c_4d, - stdlib_ndarray_c_c_5d, - stdlib_ndarray_c_c_6d, - stdlib_ndarray_c_c_7d, - stdlib_ndarray_c_c_8d, - stdlib_ndarray_c_c_9d, - stdlib_ndarray_c_c_10d, - stdlib_ndarray_c_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_c_c_2d_blocked, - stdlib_ndarray_c_c_3d_blocked, - stdlib_ndarray_c_c_4d_blocked, - stdlib_ndarray_c_c_5d_blocked, - stdlib_ndarray_c_c_6d_blocked, - stdlib_ndarray_c_c_7d_blocked, - stdlib_ndarray_c_c_8d_blocked, - stdlib_ndarray_c_c_9d_blocked, - stdlib_ndarray_c_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/c_c_as_z_z.c b/src/c_c_as_z_z.c deleted file mode 100644 index 80d2a99..0000000 --- a/src/c_c_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex64_t v; - int8_t status = stdlib_ndarray_iget_complex64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex128_to_complex64( f( stdlib_complex128_from_complex64( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex64_t, stdlib_complex128_from_complex64, stdlib_complex128_to_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_c_c_as_z_z_0d, - stdlib_ndarray_c_c_as_z_z_1d, - stdlib_ndarray_c_c_as_z_z_2d, - stdlib_ndarray_c_c_as_z_z_3d, - stdlib_ndarray_c_c_as_z_z_4d, - stdlib_ndarray_c_c_as_z_z_5d, - stdlib_ndarray_c_c_as_z_z_6d, - stdlib_ndarray_c_c_as_z_z_7d, - stdlib_ndarray_c_c_as_z_z_8d, - stdlib_ndarray_c_c_as_z_z_9d, - stdlib_ndarray_c_c_as_z_z_10d, - stdlib_ndarray_c_c_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_c_c_as_z_z_2d_blocked, - stdlib_ndarray_c_c_as_z_z_3d_blocked, - stdlib_ndarray_c_c_as_z_z_4d_blocked, - stdlib_ndarray_c_c_as_z_z_5d_blocked, - stdlib_ndarray_c_c_as_z_z_6d_blocked, - stdlib_ndarray_c_c_as_z_z_7d_blocked, - stdlib_ndarray_c_c_as_z_z_8d_blocked, - stdlib_ndarray_c_c_as_z_z_9d_blocked, - stdlib_ndarray_c_c_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_c_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_c_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/c_f_as_c_f.c b/src/c_f_as_c_f.c deleted file mode 100644 index bff2475..0000000 --- a/src/c_f_as_c_f.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex64_t v; - int8_t status = stdlib_ndarray_iget_complex64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_c_f_as_c_f_0d, - stdlib_ndarray_c_f_as_c_f_1d, - stdlib_ndarray_c_f_as_c_f_2d, - stdlib_ndarray_c_f_as_c_f_3d, - stdlib_ndarray_c_f_as_c_f_4d, - stdlib_ndarray_c_f_as_c_f_5d, - stdlib_ndarray_c_f_as_c_f_6d, - stdlib_ndarray_c_f_as_c_f_7d, - stdlib_ndarray_c_f_as_c_f_8d, - stdlib_ndarray_c_f_as_c_f_9d, - stdlib_ndarray_c_f_as_c_f_10d, - stdlib_ndarray_c_f_as_c_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_c_f_as_c_f_2d_blocked, - stdlib_ndarray_c_f_as_c_f_3d_blocked, - stdlib_ndarray_c_f_as_c_f_4d_blocked, - stdlib_ndarray_c_f_as_c_f_5d_blocked, - stdlib_ndarray_c_f_as_c_f_6d_blocked, - stdlib_ndarray_c_f_as_c_f_7d_blocked, - stdlib_ndarray_c_f_as_c_f_8d_blocked, - stdlib_ndarray_c_f_as_c_f_9d_blocked, - stdlib_ndarray_c_f_as_c_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_f_as_c_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_f_as_c_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_f_as_c_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/c_z.c b/src/c_z.c deleted file mode 100644 index e1d6f9f..0000000 --- a/src/c_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/c_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex64_t v; - int8_t status = stdlib_ndarray_iget_complex64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex64( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_c_z_0d, - stdlib_ndarray_c_z_1d, - stdlib_ndarray_c_z_2d, - stdlib_ndarray_c_z_3d, - stdlib_ndarray_c_z_4d, - stdlib_ndarray_c_z_5d, - stdlib_ndarray_c_z_6d, - stdlib_ndarray_c_z_7d, - stdlib_ndarray_c_z_8d, - stdlib_ndarray_c_z_9d, - stdlib_ndarray_c_z_10d, - stdlib_ndarray_c_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_c_z_2d_blocked, - stdlib_ndarray_c_z_3d_blocked, - stdlib_ndarray_c_z_4d_blocked, - stdlib_ndarray_c_z_5d_blocked, - stdlib_ndarray_c_z_6d_blocked, - stdlib_ndarray_c_z_7d_blocked, - stdlib_ndarray_c_z_8d_blocked, - stdlib_ndarray_c_z_9d_blocked, - stdlib_ndarray_c_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/c_z_as_c_z.c b/src/c_z_as_c_z.c deleted file mode 100644 index 64a2172..0000000 --- a/src/c_z_as_c_z.c +++ /dev/null @@ -1,2214 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex64_t v; - int8_t status = stdlib_ndarray_iget_complex64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( stdlib_complex64_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_c_z_as_c_z_0d, - stdlib_ndarray_c_z_as_c_z_1d, - stdlib_ndarray_c_z_as_c_z_2d, - stdlib_ndarray_c_z_as_c_z_3d, - stdlib_ndarray_c_z_as_c_z_4d, - stdlib_ndarray_c_z_as_c_z_5d, - stdlib_ndarray_c_z_as_c_z_6d, - stdlib_ndarray_c_z_as_c_z_7d, - stdlib_ndarray_c_z_as_c_z_8d, - stdlib_ndarray_c_z_as_c_z_9d, - stdlib_ndarray_c_z_as_c_z_10d, - stdlib_ndarray_c_z_as_c_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_c_z_as_c_z_2d_blocked, - stdlib_ndarray_c_z_as_c_z_3d_blocked, - stdlib_ndarray_c_z_as_c_z_4d_blocked, - stdlib_ndarray_c_z_as_c_z_5d_blocked, - stdlib_ndarray_c_z_as_c_z_6d_blocked, - stdlib_ndarray_c_z_as_c_z_7d_blocked, - stdlib_ndarray_c_z_as_c_z_8d_blocked, - stdlib_ndarray_c_z_as_c_z_9d_blocked, - stdlib_ndarray_c_z_as_c_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_c_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_c_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_c_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/c_z_as_z_z.c b/src/c_z_as_z_z.c deleted file mode 100644 index 20db6d4..0000000 --- a/src/c_z_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex64_t v; - int8_t status = stdlib_ndarray_iget_complex64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_complex64( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( stdlib_complex64_t, stdlib_complex128_t, stdlib_complex128_from_complex64, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_c_z_as_z_z_0d, - stdlib_ndarray_c_z_as_z_z_1d, - stdlib_ndarray_c_z_as_z_z_2d, - stdlib_ndarray_c_z_as_z_z_3d, - stdlib_ndarray_c_z_as_z_z_4d, - stdlib_ndarray_c_z_as_z_z_5d, - stdlib_ndarray_c_z_as_z_z_6d, - stdlib_ndarray_c_z_as_z_z_7d, - stdlib_ndarray_c_z_as_z_z_8d, - stdlib_ndarray_c_z_as_z_z_9d, - stdlib_ndarray_c_z_as_z_z_10d, - stdlib_ndarray_c_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_c_z_as_z_z_2d_blocked, - stdlib_ndarray_c_z_as_z_z_3d_blocked, - stdlib_ndarray_c_z_as_z_z_4d_blocked, - stdlib_ndarray_c_z_as_z_z_5d_blocked, - stdlib_ndarray_c_z_as_z_z_6d_blocked, - stdlib_ndarray_c_z_as_z_z_7d_blocked, - stdlib_ndarray_c_z_as_z_z_8d_blocked, - stdlib_ndarray_c_z_as_z_z_9d_blocked, - stdlib_ndarray_c_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/c_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_c_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_c_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/d_d.c b/src/d_d.c deleted file mode 100644 index ec5f3de..0000000 --- a/src/d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_0d( struct ndarray *arrays[], void *fcn ) { - double v; - int8_t status = stdlib_ndarray_iget_float64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_d_d_0d, - stdlib_ndarray_d_d_1d, - stdlib_ndarray_d_d_2d, - stdlib_ndarray_d_d_3d, - stdlib_ndarray_d_d_4d, - stdlib_ndarray_d_d_5d, - stdlib_ndarray_d_d_6d, - stdlib_ndarray_d_d_7d, - stdlib_ndarray_d_d_8d, - stdlib_ndarray_d_d_9d, - stdlib_ndarray_d_d_10d, - stdlib_ndarray_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_d_d_2d_blocked, - stdlib_ndarray_d_d_3d_blocked, - stdlib_ndarray_d_d_4d_blocked, - stdlib_ndarray_d_d_5d_blocked, - stdlib_ndarray_d_d_6d_blocked, - stdlib_ndarray_d_d_7d_blocked, - stdlib_ndarray_d_d_8d_blocked, - stdlib_ndarray_d_d_9d_blocked, - stdlib_ndarray_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/d_i_as_d_i.c b/src/d_i_as_d_i.c deleted file mode 100644 index 9c9a674..0000000 --- a/src/d_i_as_d_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_0d( struct ndarray *arrays[], void *fcn ) { - double v; - int8_t status = stdlib_ndarray_iget_float64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( double, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( double, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_d_i_as_d_i_0d, - stdlib_ndarray_d_i_as_d_i_1d, - stdlib_ndarray_d_i_as_d_i_2d, - stdlib_ndarray_d_i_as_d_i_3d, - stdlib_ndarray_d_i_as_d_i_4d, - stdlib_ndarray_d_i_as_d_i_5d, - stdlib_ndarray_d_i_as_d_i_6d, - stdlib_ndarray_d_i_as_d_i_7d, - stdlib_ndarray_d_i_as_d_i_8d, - stdlib_ndarray_d_i_as_d_i_9d, - stdlib_ndarray_d_i_as_d_i_10d, - stdlib_ndarray_d_i_as_d_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_d_i_as_d_i_2d_blocked, - stdlib_ndarray_d_i_as_d_i_3d_blocked, - stdlib_ndarray_d_i_as_d_i_4d_blocked, - stdlib_ndarray_d_i_as_d_i_5d_blocked, - stdlib_ndarray_d_i_as_d_i_6d_blocked, - stdlib_ndarray_d_i_as_d_i_7d_blocked, - stdlib_ndarray_d_i_as_d_i_8d_blocked, - stdlib_ndarray_d_i_as_d_i_9d_blocked, - stdlib_ndarray_d_i_as_d_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_i_as_d_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_i_as_d_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_i_as_d_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/d_z.c b/src/d_z.c deleted file mode 100644 index 23698b4..0000000 --- a/src/d_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/d_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_0d( struct ndarray *arrays[], void *fcn ) { - double v; - int8_t status = stdlib_ndarray_iget_float64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_float64( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_d_z_0d, - stdlib_ndarray_d_z_1d, - stdlib_ndarray_d_z_2d, - stdlib_ndarray_d_z_3d, - stdlib_ndarray_d_z_4d, - stdlib_ndarray_d_z_5d, - stdlib_ndarray_d_z_6d, - stdlib_ndarray_d_z_7d, - stdlib_ndarray_d_z_8d, - stdlib_ndarray_d_z_9d, - stdlib_ndarray_d_z_10d, - stdlib_ndarray_d_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_d_z_2d_blocked, - stdlib_ndarray_d_z_3d_blocked, - stdlib_ndarray_d_z_4d_blocked, - stdlib_ndarray_d_z_5d_blocked, - stdlib_ndarray_d_z_6d_blocked, - stdlib_ndarray_d_z_7d_blocked, - stdlib_ndarray_d_z_8d_blocked, - stdlib_ndarray_d_z_9d_blocked, - stdlib_ndarray_d_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/d_z_as_d_z.c b/src/d_z_as_d_z.c deleted file mode 100644 index 6580230..0000000 --- a/src/d_z_as_d_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_0d( struct ndarray *arrays[], void *fcn ) { - double v; - int8_t status = stdlib_ndarray_iget_float64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( double, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_d_z_as_d_z_0d, - stdlib_ndarray_d_z_as_d_z_1d, - stdlib_ndarray_d_z_as_d_z_2d, - stdlib_ndarray_d_z_as_d_z_3d, - stdlib_ndarray_d_z_as_d_z_4d, - stdlib_ndarray_d_z_as_d_z_5d, - stdlib_ndarray_d_z_as_d_z_6d, - stdlib_ndarray_d_z_as_d_z_7d, - stdlib_ndarray_d_z_as_d_z_8d, - stdlib_ndarray_d_z_as_d_z_9d, - stdlib_ndarray_d_z_as_d_z_10d, - stdlib_ndarray_d_z_as_d_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_d_z_as_d_z_2d_blocked, - stdlib_ndarray_d_z_as_d_z_3d_blocked, - stdlib_ndarray_d_z_as_d_z_4d_blocked, - stdlib_ndarray_d_z_as_d_z_5d_blocked, - stdlib_ndarray_d_z_as_d_z_6d_blocked, - stdlib_ndarray_d_z_as_d_z_7d_blocked, - stdlib_ndarray_d_z_as_d_z_8d_blocked, - stdlib_ndarray_d_z_as_d_z_9d_blocked, - stdlib_ndarray_d_z_as_d_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_d_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const double x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_d_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_d_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/d_z_as_z_z.c b/src/d_z_as_z_z.c deleted file mode 100644 index e1ae34d..0000000 --- a/src/d_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - double v; - int8_t status = stdlib_ndarray_iget_float64( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_float64( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 8 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( double, stdlib_complex128_t, stdlib_complex128_from_float64, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_d_z_as_z_z_0d, - stdlib_ndarray_d_z_as_z_z_1d, - stdlib_ndarray_d_z_as_z_z_2d, - stdlib_ndarray_d_z_as_z_z_3d, - stdlib_ndarray_d_z_as_z_z_4d, - stdlib_ndarray_d_z_as_z_z_5d, - stdlib_ndarray_d_z_as_z_z_6d, - stdlib_ndarray_d_z_as_z_z_7d, - stdlib_ndarray_d_z_as_z_z_8d, - stdlib_ndarray_d_z_as_z_z_9d, - stdlib_ndarray_d_z_as_z_z_10d, - stdlib_ndarray_d_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_d_z_as_z_z_2d_blocked, - stdlib_ndarray_d_z_as_z_z_3d_blocked, - stdlib_ndarray_d_z_as_z_z_4d_blocked, - stdlib_ndarray_d_z_as_z_z_5d_blocked, - stdlib_ndarray_d_z_as_z_z_6d_blocked, - stdlib_ndarray_d_z_as_z_z_7d_blocked, - stdlib_ndarray_d_z_as_z_z_8d_blocked, - stdlib_ndarray_d_z_as_z_z_9d_blocked, - stdlib_ndarray_d_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/d_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT64; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_d_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_d_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/dispatch.c b/src/dispatch.c deleted file mode 100644 index 2b2a601..0000000 --- a/src/dispatch.c +++ /dev/null @@ -1,394 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/iteration_order.h" -#include "stdlib/ndarray/base/bytes_per_element.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Applies a unary callback to an n-dimensional input ndarray having `ndims-1` singleton dimensions and assigns results to elements in an output ndarray having the same shape. -* -* ## Notes -* -* - If able to successfully apply a unary callback, the function returns `0`; otherwise, the function returns an error code. -* -* @param f unary ndarray function -* @param x1 input ndarray -* @param x2 output ndarray -* @param i index of the non-singleton dimension -* @param fcn callback -* @return status code -*/ -static int8_t stdlib_ndarray_unary_1d_squeeze( const ndarrayUnaryFcn f, struct ndarray *x1, struct ndarray *x2, const int64_t i, void *fcn ) { - int64_t sh[] = { stdlib_ndarray_shape( x1 )[ i ] }; - - // Shallow copy and reshape the arrays... - int64_t sx1[] = { stdlib_ndarray_strides( x1 )[ i ] }; - struct ndarray *x1c = stdlib_ndarray_allocate( - stdlib_ndarray_dtype( x1 ), - stdlib_ndarray_data( x1 ), - 1, - sh, - sx1, - stdlib_ndarray_offset( x1 ), - stdlib_ndarray_order( x1 ), - stdlib_ndarray_index_mode( x1 ), - stdlib_ndarray_nsubmodes( x1 ), - stdlib_ndarray_submodes( x1 ) - ); - if ( x1c == NULL ) { - return -1; - } - int64_t sx2[] = { stdlib_ndarray_strides( x2 )[ i ] }; - struct ndarray *x2c = stdlib_ndarray_allocate( - stdlib_ndarray_dtype( x2 ), - stdlib_ndarray_data( x2 ), - 1, - sh, - sx2, - stdlib_ndarray_offset( x2 ), - stdlib_ndarray_order( x2 ), - stdlib_ndarray_index_mode( x2 ), - stdlib_ndarray_nsubmodes( x2 ), - stdlib_ndarray_submodes( x2 ) - ); - if ( x2c == NULL ) { - stdlib_ndarray_free( x1c ); - return -1; - } - // Apply the callback: - struct ndarray *arrays[] = { x1c, x2c }; - int8_t status = f( arrays, fcn ); - - // Free allocated memory: - stdlib_ndarray_free( x1c ); - stdlib_ndarray_free( x2c ); - - return status; -} - -/** -* Applies a unary callback to a flattened n-dimensional input ndarray and assigns results to elements in a flattened n-dimensional output ndarray. -* -* ## Notes -* -* - If able to successfully apply a unary callback, the function returns `0`; otherwise, the function returns an error code. -* -* @param f unary ndarray function -* @param N number of elements -* @param x1 input ndarray -* @param s1 input ndarray stride length -* @param x2 output ndarray -* @param s2 output ndarray stride length -* @param fcn callback -* @return status code -*/ -static int8_t stdlib_ndarray_unary_1d_flatten( const ndarrayUnaryFcn f, const int64_t N, struct ndarray *x1, const int64_t s1, struct ndarray *x2, const int64_t s2, void *fcn ) { - // Define the (flattened) strided array shape: - int64_t sh[] = { N }; - - // Shallow copy and reshape the arrays... - int64_t sx1[] = { s1 }; - struct ndarray *x1c = stdlib_ndarray_allocate( - stdlib_ndarray_dtype( x1 ), - stdlib_ndarray_data( x1 ), - 1, - sh, - sx1, - stdlib_ndarray_offset( x1 ), - stdlib_ndarray_order( x1 ), - stdlib_ndarray_index_mode( x1 ), - stdlib_ndarray_nsubmodes( x1 ), - stdlib_ndarray_submodes( x1 ) - ); - if ( x1c == NULL ) { - return -1; - } - int64_t sx2[] = { s2 }; - struct ndarray *x2c = stdlib_ndarray_allocate( - stdlib_ndarray_dtype( x2 ), - stdlib_ndarray_data( x2 ), - 1, - sh, - sx2, - stdlib_ndarray_offset( x2 ), - stdlib_ndarray_order( x2 ), - stdlib_ndarray_index_mode( x2 ), - stdlib_ndarray_nsubmodes( x2 ), - stdlib_ndarray_submodes( x2 ) - ); - if ( x2c == NULL ) { - stdlib_ndarray_free( x1c ); - return -1; - } - // Apply the callback: - struct ndarray *arrays[] = { x1c, x2c }; - int8_t status = f( arrays, fcn ); - - // Free allocated memory: - stdlib_ndarray_free( x1c ); - stdlib_ndarray_free( x2c ); - - return status; -} - -/** -* Dispatches to a unary ndarray function according to the dimensionality of provided ndarray arguments. -* -* ## Notes -* -* - If able to successfully dispatch, the function returns `0`; otherwise, the function returns an error code. -* -* @param obj object comprised of dispatch tables containing unary ndarray functions -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/dispatch.h" -* #include "stdlib/ndarray/base/unary/dispatch_object.h" -* #include "stdlib/ndarray/base/unary/typedefs.h" -* #include "stdlib/ndarray/base/unary/b_b.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define a list of unary ndarray functions: -* ndarrayUnaryFcn functions[] = { -* stdlib_ndarray_b_b_0d, -* stdlib_ndarray_b_b_1d, -* stdlib_ndarray_b_b_2d, -* stdlib_ndarray_b_b_3d, -* stdlib_ndarray_b_b_4d, -* stdlib_ndarray_b_b_5d, -* stdlib_ndarray_b_b_6d, -* stdlib_ndarray_b_b_7d, -* stdlib_ndarray_b_b_8d, -* stdlib_ndarray_b_b_9d, -* stdlib_ndarray_b_b_10d -* stdlib_ndarray_b_b_nd -* }; -* -* // Define a list of unary ndarray functions using loop blocking: -* ndarrayUnaryFcn blocked_functions[] = { -* stdlib_ndarray_b_b_2d_blocked, -* stdlib_ndarray_b_b_3d_blocked, -* stdlib_ndarray_b_b_4d_blocked, -* stdlib_ndarray_b_b_5d_blocked, -* stdlib_ndarray_b_b_6d_blocked, -* stdlib_ndarray_b_b_7d_blocked, -* stdlib_ndarray_b_b_8d_blocked, -* stdlib_ndarray_b_b_9d_blocked, -* stdlib_ndarray_b_b_10d_blocked -* }; -* -* // Create a unary function dispatch object: -* struct ndarrayUnaryDispatchObject obj = { -* // Array containing unary ndarray functions: -* functions, -* -* // Number of unary ndarray functions: -* 12, -* -* // Array containing unary ndarray functions using loop blocking: -* blocked_functions, -* -* // Number of unary ndarray functions using loop blocking: -* 9 -* } -* -* // Define a function which performs dispatch: -* int8_t stdlib_ndarray_b_b( struct ndarray *arrays[], void *fcn ) { -* return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -* } -* -* // ... -* -* // Create ndarrays... -* struct ndarray *x = stdlib_ndarray_allocate( ... ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* struct ndarray *y = stdlib_ndarray_allocate( ... ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Define a callback: -* uint8_t scale( const uint8_t x ) { -* return x + 10; -* } -* -* // Apply the callback: -* struct ndarray *arrays[] = { x, y }; -* int8_t status = stdlib_ndarray_b_b( arrays, (void *)scale ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -*/ -int8_t stdlib_ndarray_unary_dispatch( const struct ndarrayUnaryDispatchObject *obj, struct ndarray *arrays[], void *fcn ) { - const int64_t *sh1; - const int64_t *sh2; - struct ndarray *x1; - struct ndarray *x2; - int8_t status; - int64_t ndims; - int64_t mab1; - int64_t mab2; - int64_t mib1; - int64_t mib2; - int64_t *s1; - int64_t *s2; - int64_t len; - int64_t bp1; - int64_t bp2; - int8_t io1; - int8_t io2; - int64_t ns; - int64_t s; - int64_t d; - int64_t i; - - // Unpack the arrays: - x1 = arrays[ 0 ]; - x2 = arrays[ 1 ]; - - // Verify that the input and output arrays have the same number of dimensions... - ndims = stdlib_ndarray_ndims( x1 ); - if ( ndims != stdlib_ndarray_ndims( x2 ) ) { - return -1; // TODO: consider standardized error codes - } - // Determine whether we can avoid iteration altogether... - if ( ndims == 0 ) { - obj->functions[ 0 ]( arrays, fcn ); - return 0; - } - sh1 = stdlib_ndarray_shape( x1 ); - sh2 = stdlib_ndarray_shape( x2 ); - - // Verify that the input and output arrays have the same dimensions... - len = 1; // number of elements - ns = 0; // number of singleton dimensions - for ( i = 0; i < ndims; i++ ) { - d = sh1[ i ]; - if ( d != sh2[ i ] ) { - return -1; // TODO: consider standardized error codes - } - // Note that, if one of the dimensions is `0`, the length will be `0`... - len *= d; - - // Check whether the current dimension is a singleton dimension... - if ( d == 1 ) { - ns += 1; - } - } - // Check whether we were provided empty ndarrays... - if ( len == 0 ) { - return 0; - } - // Determine whether the ndarrays are one-dimensional and thus readily translate to one-dimensional strided arrays... - if ( ndims == 1 ) { - obj->functions[ 1 ]( arrays, fcn ); - return 0; - } - // Determine whether the ndarrays have only **one** non-singleton dimension (e.g., ndims=4, shape=[10,1,1,1]) so that we can treat the ndarrays as being equivalent to one-dimensional strided arrays... - if ( ns == ndims-1 ) { - // Get the index of the non-singleton dimension... - for ( i = 0; i < ndims; i++ ) { - if ( sh1[ i ] != 1 ) { - break; - } - } - // Remove the singleton dimensions and apply the unary function... - status = stdlib_ndarray_unary_1d_squeeze( obj->functions[ 1 ], x1, x2, i, fcn ); - if ( status == 0 ) { - return 0; - } - // If we failed, this is probably due to failed memory allocation, so fall through and try again... - } - s1 = stdlib_ndarray_strides( x1 ); - s2 = stdlib_ndarray_strides( x2 ); - io1 = stdlib_ndarray_iteration_order( ndims, s1 ); // +/-1 - io2 = stdlib_ndarray_iteration_order( ndims, s2 ); // +/-1 - - // Determine whether we can avoid blocked iteration... - if ( io1 != 0 && io2 != 0 && stdlib_ndarray_order( x1 ) == stdlib_ndarray_order( x2 ) ) { - // Determine the minimum and maximum linear byte indices which are accessible by the array views: - mib1 = stdlib_ndarray_offset( x1 ); // byte offset - mab1 = mib1; - mib2 = stdlib_ndarray_offset( x2 ); // byte offset - mab2 = mib2; - for ( i = 0; i < ndims; i++ ) { - s = s1[ i ]; // units: bytes - if ( s > 0 ) { - mab1 += s * ( sh1[i]-1 ); - } else if ( s < 0 ) { - mib1 += s * ( sh1[i]-1 ); // decrements - } - s = s2[ i ]; - if ( s > 0 ) { - mab2 += s * ( sh2[i]-1 ); - } else if ( s < 0 ) { - mib2 += s * ( sh2[i]-1 ); // decrements - } - } - bp1 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x1 ) ); - bp2 = stdlib_ndarray_bytes_per_element( stdlib_ndarray_dtype( x2 ) ); - - // Determine whether we can ignore shape (and strides) and treat the ndarrays as linear one-dimensional strided arrays... - if ( ( len*bp1 ) == ( mab1-mib1+bp1 ) && ( len*bp2 ) == ( mab2-mib2+bp2 ) ) { - // Note: the above is equivalent to @stdlib/ndarray/base/assert/is-contiguous, but in-lined so we can retain computed values... - status = stdlib_ndarray_unary_1d_flatten( obj->functions[ 1 ], len, x1, io1*bp1, x2, io2*bp2, fcn ); - if ( status == 0 ) { - return 0; - } - // If we failed, this is probably due to failed memory allocation, so fall through and try again... - } - // At least one ndarray is non-contiguous, so we cannot directly use one-dimensional array functionality... - - // Determine whether we can use simple nested loops... - if ( ndims < (obj->nfunctions) ) { - // So long as iteration for each respective array always moves in the same direction (i.e., no mixed sign strides), we can leverage cache-optimal (i.e., normal) nested loops without resorting to blocked iteration... - obj->functions[ ndims ]( arrays, fcn ); - return 0; - } - // Fall-through to blocked iteration... - } - // At this point, we're either dealing with non-contiguous n-dimensional arrays, high dimensional n-dimensional arrays, and/or arrays having differing memory layouts, so our only hope is that we can still perform blocked iteration... - - // Determine whether we can perform blocked iteration... - if ( ndims <= (obj->nblockedfunctions)+1 ) { - obj->blocked_functions[ ndims-2 ]( arrays, fcn ); - return 0; - } - // Fall-through to linear view iteration without regard for how data is stored in memory (i.e., take the slow path)... - obj->functions[ (obj->nfunctions)-1 ]( arrays, fcn ); - - return 0; -} diff --git a/src/f_c.c b/src/f_c.c deleted file mode 100644 index 1ce9ed7..0000000 --- a/src/f_c.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_float32( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_c_0d, - stdlib_ndarray_f_c_1d, - stdlib_ndarray_f_c_2d, - stdlib_ndarray_f_c_3d, - stdlib_ndarray_f_c_4d, - stdlib_ndarray_f_c_5d, - stdlib_ndarray_f_c_6d, - stdlib_ndarray_f_c_7d, - stdlib_ndarray_f_c_8d, - stdlib_ndarray_f_c_9d, - stdlib_ndarray_f_c_10d, - stdlib_ndarray_f_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_c_2d_blocked, - stdlib_ndarray_f_c_3d_blocked, - stdlib_ndarray_f_c_4d_blocked, - stdlib_ndarray_f_c_5d_blocked, - stdlib_ndarray_f_c_6d_blocked, - stdlib_ndarray_f_c_7d_blocked, - stdlib_ndarray_f_c_8d_blocked, - stdlib_ndarray_f_c_9d_blocked, - stdlib_ndarray_f_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_c_as_c_c.c b/src/f_c_as_c_c.c deleted file mode 100644 index 68f8787..0000000 --- a/src/f_c_as_c_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_complex64( f( stdlib_complex64_from_float32( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex64_from_float32, stdlib_complex64_from_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_c_as_c_c_0d, - stdlib_ndarray_f_c_as_c_c_1d, - stdlib_ndarray_f_c_as_c_c_2d, - stdlib_ndarray_f_c_as_c_c_3d, - stdlib_ndarray_f_c_as_c_c_4d, - stdlib_ndarray_f_c_as_c_c_5d, - stdlib_ndarray_f_c_as_c_c_6d, - stdlib_ndarray_f_c_as_c_c_7d, - stdlib_ndarray_f_c_as_c_c_8d, - stdlib_ndarray_f_c_as_c_c_9d, - stdlib_ndarray_f_c_as_c_c_10d, - stdlib_ndarray_f_c_as_c_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_c_as_c_c_2d_blocked, - stdlib_ndarray_f_c_as_c_c_3d_blocked, - stdlib_ndarray_f_c_as_c_c_4d_blocked, - stdlib_ndarray_f_c_as_c_c_5d_blocked, - stdlib_ndarray_f_c_as_c_c_6d_blocked, - stdlib_ndarray_f_c_as_c_c_7d_blocked, - stdlib_ndarray_f_c_as_c_c_8d_blocked, - stdlib_ndarray_f_c_as_c_c_9d_blocked, - stdlib_ndarray_f_c_as_c_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_c_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_c_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_c_as_f_c.c b/src/f_c_as_f_c.c deleted file mode 100644 index a0e4e43..0000000 --- a/src/f_c_as_f_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( float, stdlib_complex64_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_c_as_f_c_0d, - stdlib_ndarray_f_c_as_f_c_1d, - stdlib_ndarray_f_c_as_f_c_2d, - stdlib_ndarray_f_c_as_f_c_3d, - stdlib_ndarray_f_c_as_f_c_4d, - stdlib_ndarray_f_c_as_f_c_5d, - stdlib_ndarray_f_c_as_f_c_6d, - stdlib_ndarray_f_c_as_f_c_7d, - stdlib_ndarray_f_c_as_f_c_8d, - stdlib_ndarray_f_c_as_f_c_9d, - stdlib_ndarray_f_c_as_f_c_10d, - stdlib_ndarray_f_c_as_f_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_c_as_f_c_2d_blocked, - stdlib_ndarray_f_c_as_f_c_3d_blocked, - stdlib_ndarray_f_c_as_f_c_4d_blocked, - stdlib_ndarray_f_c_as_f_c_5d_blocked, - stdlib_ndarray_f_c_as_f_c_6d_blocked, - stdlib_ndarray_f_c_as_f_c_7d_blocked, - stdlib_ndarray_f_c_as_f_c_8d_blocked, - stdlib_ndarray_f_c_as_f_c_9d_blocked, - stdlib_ndarray_f_c_as_f_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_f_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_f_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_f_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_c_as_z_z.c b/src/f_c_as_z_z.c deleted file mode 100644 index 0938691..0000000 --- a/src/f_c_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex128_to_complex64( f( stdlib_complex128_from_float32( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex64_t, stdlib_complex128_from_float32, stdlib_complex128_to_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_c_as_z_z_0d, - stdlib_ndarray_f_c_as_z_z_1d, - stdlib_ndarray_f_c_as_z_z_2d, - stdlib_ndarray_f_c_as_z_z_3d, - stdlib_ndarray_f_c_as_z_z_4d, - stdlib_ndarray_f_c_as_z_z_5d, - stdlib_ndarray_f_c_as_z_z_6d, - stdlib_ndarray_f_c_as_z_z_7d, - stdlib_ndarray_f_c_as_z_z_8d, - stdlib_ndarray_f_c_as_z_z_9d, - stdlib_ndarray_f_c_as_z_z_10d, - stdlib_ndarray_f_c_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_c_as_z_z_2d_blocked, - stdlib_ndarray_f_c_as_z_z_3d_blocked, - stdlib_ndarray_f_c_as_z_z_4d_blocked, - stdlib_ndarray_f_c_as_z_z_5d_blocked, - stdlib_ndarray_f_c_as_z_z_6d_blocked, - stdlib_ndarray_f_c_as_z_z_7d_blocked, - stdlib_ndarray_f_c_as_z_z_8d_blocked, - stdlib_ndarray_f_c_as_z_z_9d_blocked, - stdlib_ndarray_f_c_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_c_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_c_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_d.c b/src/f_d.c deleted file mode 100644 index 2646a41..0000000 --- a/src/f_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_d_0d, - stdlib_ndarray_f_d_1d, - stdlib_ndarray_f_d_2d, - stdlib_ndarray_f_d_3d, - stdlib_ndarray_f_d_4d, - stdlib_ndarray_f_d_5d, - stdlib_ndarray_f_d_6d, - stdlib_ndarray_f_d_7d, - stdlib_ndarray_f_d_8d, - stdlib_ndarray_f_d_9d, - stdlib_ndarray_f_d_10d, - stdlib_ndarray_f_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_d_2d_blocked, - stdlib_ndarray_f_d_3d_blocked, - stdlib_ndarray_f_d_4d_blocked, - stdlib_ndarray_f_d_5d_blocked, - stdlib_ndarray_f_d_6d_blocked, - stdlib_ndarray_f_d_7d_blocked, - stdlib_ndarray_f_d_8d_blocked, - stdlib_ndarray_f_d_9d_blocked, - stdlib_ndarray_f_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_d_as_d_d.c b/src/f_d_as_d_d.c deleted file mode 100644 index 01f3bc5..0000000 --- a/src/f_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( float, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_d_as_d_d_0d, - stdlib_ndarray_f_d_as_d_d_1d, - stdlib_ndarray_f_d_as_d_d_2d, - stdlib_ndarray_f_d_as_d_d_3d, - stdlib_ndarray_f_d_as_d_d_4d, - stdlib_ndarray_f_d_as_d_d_5d, - stdlib_ndarray_f_d_as_d_d_6d, - stdlib_ndarray_f_d_as_d_d_7d, - stdlib_ndarray_f_d_as_d_d_8d, - stdlib_ndarray_f_d_as_d_d_9d, - stdlib_ndarray_f_d_as_d_d_10d, - stdlib_ndarray_f_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_d_as_d_d_2d_blocked, - stdlib_ndarray_f_d_as_d_d_3d_blocked, - stdlib_ndarray_f_d_as_d_d_4d_blocked, - stdlib_ndarray_f_d_as_d_d_5d_blocked, - stdlib_ndarray_f_d_as_d_d_6d_blocked, - stdlib_ndarray_f_d_as_d_d_7d_blocked, - stdlib_ndarray_f_d_as_d_d_8d_blocked, - stdlib_ndarray_f_d_as_d_d_9d_blocked, - stdlib_ndarray_f_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_d_as_f_d.c b/src/f_d_as_f_d.c deleted file mode 100644 index 934cbfc..0000000 --- a/src/f_d_as_f_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_d_as_f_d_0d, - stdlib_ndarray_f_d_as_f_d_1d, - stdlib_ndarray_f_d_as_f_d_2d, - stdlib_ndarray_f_d_as_f_d_3d, - stdlib_ndarray_f_d_as_f_d_4d, - stdlib_ndarray_f_d_as_f_d_5d, - stdlib_ndarray_f_d_as_f_d_6d, - stdlib_ndarray_f_d_as_f_d_7d, - stdlib_ndarray_f_d_as_f_d_8d, - stdlib_ndarray_f_d_as_f_d_9d, - stdlib_ndarray_f_d_as_f_d_10d, - stdlib_ndarray_f_d_as_f_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_d_as_f_d_2d_blocked, - stdlib_ndarray_f_d_as_f_d_3d_blocked, - stdlib_ndarray_f_d_as_f_d_4d_blocked, - stdlib_ndarray_f_d_as_f_d_5d_blocked, - stdlib_ndarray_f_d_as_f_d_6d_blocked, - stdlib_ndarray_f_d_as_f_d_7d_blocked, - stdlib_ndarray_f_d_as_f_d_8d_blocked, - stdlib_ndarray_f_d_as_f_d_9d_blocked, - stdlib_ndarray_f_d_as_f_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_d_as_f_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_d_as_f_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_d_as_f_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_f.c b/src/f_f.c deleted file mode 100644 index da81b64..0000000 --- a/src/f_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( float, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( float, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_f_0d, - stdlib_ndarray_f_f_1d, - stdlib_ndarray_f_f_2d, - stdlib_ndarray_f_f_3d, - stdlib_ndarray_f_f_4d, - stdlib_ndarray_f_f_5d, - stdlib_ndarray_f_f_6d, - stdlib_ndarray_f_f_7d, - stdlib_ndarray_f_f_8d, - stdlib_ndarray_f_f_9d, - stdlib_ndarray_f_f_10d, - stdlib_ndarray_f_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_f_2d_blocked, - stdlib_ndarray_f_f_3d_blocked, - stdlib_ndarray_f_f_4d_blocked, - stdlib_ndarray_f_f_5d_blocked, - stdlib_ndarray_f_f_6d_blocked, - stdlib_ndarray_f_f_7d_blocked, - stdlib_ndarray_f_f_8d_blocked, - stdlib_ndarray_f_f_9d_blocked, - stdlib_ndarray_f_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_f_as_d_d.c b/src/f_f_as_d_d.c deleted file mode 100644 index 96d9f68..0000000 --- a/src/f_f_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( float, float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_f_as_d_d_0d, - stdlib_ndarray_f_f_as_d_d_1d, - stdlib_ndarray_f_f_as_d_d_2d, - stdlib_ndarray_f_f_as_d_d_3d, - stdlib_ndarray_f_f_as_d_d_4d, - stdlib_ndarray_f_f_as_d_d_5d, - stdlib_ndarray_f_f_as_d_d_6d, - stdlib_ndarray_f_f_as_d_d_7d, - stdlib_ndarray_f_f_as_d_d_8d, - stdlib_ndarray_f_f_as_d_d_9d, - stdlib_ndarray_f_f_as_d_d_10d, - stdlib_ndarray_f_f_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_f_as_d_d_2d_blocked, - stdlib_ndarray_f_f_as_d_d_3d_blocked, - stdlib_ndarray_f_f_as_d_d_4d_blocked, - stdlib_ndarray_f_f_as_d_d_5d_blocked, - stdlib_ndarray_f_f_as_d_d_6d_blocked, - stdlib_ndarray_f_f_as_d_d_7d_blocked, - stdlib_ndarray_f_f_as_d_d_8d_blocked, - stdlib_ndarray_f_f_as_d_d_9d_blocked, - stdlib_ndarray_f_f_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_f_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_f_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_i_as_f_i.c b/src/f_i_as_f_i.c deleted file mode 100644 index 2b335a2..0000000 --- a/src/f_i_as_f_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( float, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( float, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_i_as_f_i_0d, - stdlib_ndarray_f_i_as_f_i_1d, - stdlib_ndarray_f_i_as_f_i_2d, - stdlib_ndarray_f_i_as_f_i_3d, - stdlib_ndarray_f_i_as_f_i_4d, - stdlib_ndarray_f_i_as_f_i_5d, - stdlib_ndarray_f_i_as_f_i_6d, - stdlib_ndarray_f_i_as_f_i_7d, - stdlib_ndarray_f_i_as_f_i_8d, - stdlib_ndarray_f_i_as_f_i_9d, - stdlib_ndarray_f_i_as_f_i_10d, - stdlib_ndarray_f_i_as_f_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_i_as_f_i_2d_blocked, - stdlib_ndarray_f_i_as_f_i_3d_blocked, - stdlib_ndarray_f_i_as_f_i_4d_blocked, - stdlib_ndarray_f_i_as_f_i_5d_blocked, - stdlib_ndarray_f_i_as_f_i_6d_blocked, - stdlib_ndarray_f_i_as_f_i_7d_blocked, - stdlib_ndarray_f_i_as_f_i_8d_blocked, - stdlib_ndarray_f_i_as_f_i_9d_blocked, - stdlib_ndarray_f_i_as_f_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_i_as_f_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_i_as_f_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_i_as_f_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_z.c b/src/f_z.c deleted file mode 100644 index 5c836a2..0000000 --- a/src/f_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_float32( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_z_0d, - stdlib_ndarray_f_z_1d, - stdlib_ndarray_f_z_2d, - stdlib_ndarray_f_z_3d, - stdlib_ndarray_f_z_4d, - stdlib_ndarray_f_z_5d, - stdlib_ndarray_f_z_6d, - stdlib_ndarray_f_z_7d, - stdlib_ndarray_f_z_8d, - stdlib_ndarray_f_z_9d, - stdlib_ndarray_f_z_10d, - stdlib_ndarray_f_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_z_2d_blocked, - stdlib_ndarray_f_z_3d_blocked, - stdlib_ndarray_f_z_4d_blocked, - stdlib_ndarray_f_z_5d_blocked, - stdlib_ndarray_f_z_6d_blocked, - stdlib_ndarray_f_z_7d_blocked, - stdlib_ndarray_f_z_8d_blocked, - stdlib_ndarray_f_z_9d_blocked, - stdlib_ndarray_f_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_z_as_f_z.c b/src/f_z_as_f_z.c deleted file mode 100644 index 5aabfc2..0000000 --- a/src/f_z_as_f_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( float, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_z_as_f_z_0d, - stdlib_ndarray_f_z_as_f_z_1d, - stdlib_ndarray_f_z_as_f_z_2d, - stdlib_ndarray_f_z_as_f_z_3d, - stdlib_ndarray_f_z_as_f_z_4d, - stdlib_ndarray_f_z_as_f_z_5d, - stdlib_ndarray_f_z_as_f_z_6d, - stdlib_ndarray_f_z_as_f_z_7d, - stdlib_ndarray_f_z_as_f_z_8d, - stdlib_ndarray_f_z_as_f_z_9d, - stdlib_ndarray_f_z_as_f_z_10d, - stdlib_ndarray_f_z_as_f_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_z_as_f_z_2d_blocked, - stdlib_ndarray_f_z_as_f_z_3d_blocked, - stdlib_ndarray_f_z_as_f_z_4d_blocked, - stdlib_ndarray_f_z_as_f_z_5d_blocked, - stdlib_ndarray_f_z_as_f_z_6d_blocked, - stdlib_ndarray_f_z_as_f_z_7d_blocked, - stdlib_ndarray_f_z_as_f_z_8d_blocked, - stdlib_ndarray_f_z_as_f_z_9d_blocked, - stdlib_ndarray_f_z_as_f_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_f_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const float x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_f_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_f_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/f_z_as_z_z.c b/src/f_z_as_z_z.c deleted file mode 100644 index 631160a..0000000 --- a/src/f_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - float v; - int8_t status = stdlib_ndarray_iget_float32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_float32( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( float, stdlib_complex128_t, stdlib_complex128_from_float32, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_f_z_as_z_z_0d, - stdlib_ndarray_f_z_as_z_z_1d, - stdlib_ndarray_f_z_as_z_z_2d, - stdlib_ndarray_f_z_as_z_z_3d, - stdlib_ndarray_f_z_as_z_z_4d, - stdlib_ndarray_f_z_as_z_z_5d, - stdlib_ndarray_f_z_as_z_z_6d, - stdlib_ndarray_f_z_as_z_z_7d, - stdlib_ndarray_f_z_as_z_z_8d, - stdlib_ndarray_f_z_as_z_z_9d, - stdlib_ndarray_f_z_as_z_z_10d, - stdlib_ndarray_f_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_f_z_as_z_z_2d_blocked, - stdlib_ndarray_f_z_as_z_z_3d_blocked, - stdlib_ndarray_f_z_as_z_z_4d_blocked, - stdlib_ndarray_f_z_as_z_z_5d_blocked, - stdlib_ndarray_f_z_as_z_z_6d_blocked, - stdlib_ndarray_f_z_as_z_z_7d_blocked, - stdlib_ndarray_f_z_as_z_z_8d_blocked, - stdlib_ndarray_f_z_as_z_z_9d_blocked, - stdlib_ndarray_f_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/f_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_FLOAT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_f_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_f_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_d.c b/src/i_d.c deleted file mode 100644 index f98060b..0000000 --- a/src/i_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int32_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_d_0d, - stdlib_ndarray_i_d_1d, - stdlib_ndarray_i_d_2d, - stdlib_ndarray_i_d_3d, - stdlib_ndarray_i_d_4d, - stdlib_ndarray_i_d_5d, - stdlib_ndarray_i_d_6d, - stdlib_ndarray_i_d_7d, - stdlib_ndarray_i_d_8d, - stdlib_ndarray_i_d_9d, - stdlib_ndarray_i_d_10d, - stdlib_ndarray_i_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_d_2d_blocked, - stdlib_ndarray_i_d_3d_blocked, - stdlib_ndarray_i_d_4d_blocked, - stdlib_ndarray_i_d_5d_blocked, - stdlib_ndarray_i_d_6d_blocked, - stdlib_ndarray_i_d_7d_blocked, - stdlib_ndarray_i_d_8d_blocked, - stdlib_ndarray_i_d_9d_blocked, - stdlib_ndarray_i_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_d_as_d_d.c b/src/i_d_as_d_d.c deleted file mode 100644 index 25f93fd..0000000 --- a/src/i_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int32_t, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_d_as_d_d_0d, - stdlib_ndarray_i_d_as_d_d_1d, - stdlib_ndarray_i_d_as_d_d_2d, - stdlib_ndarray_i_d_as_d_d_3d, - stdlib_ndarray_i_d_as_d_d_4d, - stdlib_ndarray_i_d_as_d_d_5d, - stdlib_ndarray_i_d_as_d_d_6d, - stdlib_ndarray_i_d_as_d_d_7d, - stdlib_ndarray_i_d_as_d_d_8d, - stdlib_ndarray_i_d_as_d_d_9d, - stdlib_ndarray_i_d_as_d_d_10d, - stdlib_ndarray_i_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_d_as_d_d_2d_blocked, - stdlib_ndarray_i_d_as_d_d_3d_blocked, - stdlib_ndarray_i_d_as_d_d_4d_blocked, - stdlib_ndarray_i_d_as_d_d_5d_blocked, - stdlib_ndarray_i_d_as_d_d_6d_blocked, - stdlib_ndarray_i_d_as_d_d_7d_blocked, - stdlib_ndarray_i_d_as_d_d_8d_blocked, - stdlib_ndarray_i_d_as_d_d_9d_blocked, - stdlib_ndarray_i_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_d_as_i_d.c b/src/i_d_as_i_d.c deleted file mode 100644 index 46fce1d..0000000 --- a/src/i_d_as_i_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int32_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_d_as_i_d_0d, - stdlib_ndarray_i_d_as_i_d_1d, - stdlib_ndarray_i_d_as_i_d_2d, - stdlib_ndarray_i_d_as_i_d_3d, - stdlib_ndarray_i_d_as_i_d_4d, - stdlib_ndarray_i_d_as_i_d_5d, - stdlib_ndarray_i_d_as_i_d_6d, - stdlib_ndarray_i_d_as_i_d_7d, - stdlib_ndarray_i_d_as_i_d_8d, - stdlib_ndarray_i_d_as_i_d_9d, - stdlib_ndarray_i_d_as_i_d_10d, - stdlib_ndarray_i_d_as_i_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_d_as_i_d_2d_blocked, - stdlib_ndarray_i_d_as_i_d_3d_blocked, - stdlib_ndarray_i_d_as_i_d_4d_blocked, - stdlib_ndarray_i_d_as_i_d_5d_blocked, - stdlib_ndarray_i_d_as_i_d_6d_blocked, - stdlib_ndarray_i_d_as_i_d_7d_blocked, - stdlib_ndarray_i_d_as_i_d_8d_blocked, - stdlib_ndarray_i_d_as_i_d_9d_blocked, - stdlib_ndarray_i_d_as_i_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_d_as_i_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_d_as_i_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_d_as_i_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_i.c b/src/i_i.c deleted file mode 100644 index cbd3335..0000000 --- a/src/i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_i_0d, - stdlib_ndarray_i_i_1d, - stdlib_ndarray_i_i_2d, - stdlib_ndarray_i_i_3d, - stdlib_ndarray_i_i_4d, - stdlib_ndarray_i_i_5d, - stdlib_ndarray_i_i_6d, - stdlib_ndarray_i_i_7d, - stdlib_ndarray_i_i_8d, - stdlib_ndarray_i_i_9d, - stdlib_ndarray_i_i_10d, - stdlib_ndarray_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_i_2d_blocked, - stdlib_ndarray_i_i_3d_blocked, - stdlib_ndarray_i_i_4d_blocked, - stdlib_ndarray_i_i_5d_blocked, - stdlib_ndarray_i_i_6d_blocked, - stdlib_ndarray_i_i_7d_blocked, - stdlib_ndarray_i_i_8d_blocked, - stdlib_ndarray_i_i_9d_blocked, - stdlib_ndarray_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_u.c b/src/i_u.c deleted file mode 100644 index 404b47c..0000000 --- a/src/i_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int32_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_u_0d, - stdlib_ndarray_i_u_1d, - stdlib_ndarray_i_u_2d, - stdlib_ndarray_i_u_3d, - stdlib_ndarray_i_u_4d, - stdlib_ndarray_i_u_5d, - stdlib_ndarray_i_u_6d, - stdlib_ndarray_i_u_7d, - stdlib_ndarray_i_u_8d, - stdlib_ndarray_i_u_9d, - stdlib_ndarray_i_u_10d, - stdlib_ndarray_i_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_u_2d_blocked, - stdlib_ndarray_i_u_3d_blocked, - stdlib_ndarray_i_u_4d_blocked, - stdlib_ndarray_i_u_5d_blocked, - stdlib_ndarray_i_u_6d_blocked, - stdlib_ndarray_i_u_7d_blocked, - stdlib_ndarray_i_u_8d_blocked, - stdlib_ndarray_i_u_9d_blocked, - stdlib_ndarray_i_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_z.c b/src/i_z.c deleted file mode 100644 index 4f73953..0000000 --- a/src/i_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_int32( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_z_0d, - stdlib_ndarray_i_z_1d, - stdlib_ndarray_i_z_2d, - stdlib_ndarray_i_z_3d, - stdlib_ndarray_i_z_4d, - stdlib_ndarray_i_z_5d, - stdlib_ndarray_i_z_6d, - stdlib_ndarray_i_z_7d, - stdlib_ndarray_i_z_8d, - stdlib_ndarray_i_z_9d, - stdlib_ndarray_i_z_10d, - stdlib_ndarray_i_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_z_2d_blocked, - stdlib_ndarray_i_z_3d_blocked, - stdlib_ndarray_i_z_4d_blocked, - stdlib_ndarray_i_z_5d_blocked, - stdlib_ndarray_i_z_6d_blocked, - stdlib_ndarray_i_z_7d_blocked, - stdlib_ndarray_i_z_8d_blocked, - stdlib_ndarray_i_z_9d_blocked, - stdlib_ndarray_i_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_z_as_i_z.c b/src/i_z_as_i_z.c deleted file mode 100644 index 94722ad..0000000 --- a/src/i_z_as_i_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( int32_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_z_as_i_z_0d, - stdlib_ndarray_i_z_as_i_z_1d, - stdlib_ndarray_i_z_as_i_z_2d, - stdlib_ndarray_i_z_as_i_z_3d, - stdlib_ndarray_i_z_as_i_z_4d, - stdlib_ndarray_i_z_as_i_z_5d, - stdlib_ndarray_i_z_as_i_z_6d, - stdlib_ndarray_i_z_as_i_z_7d, - stdlib_ndarray_i_z_as_i_z_8d, - stdlib_ndarray_i_z_as_i_z_9d, - stdlib_ndarray_i_z_as_i_z_10d, - stdlib_ndarray_i_z_as_i_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_z_as_i_z_2d_blocked, - stdlib_ndarray_i_z_as_i_z_3d_blocked, - stdlib_ndarray_i_z_as_i_z_4d_blocked, - stdlib_ndarray_i_z_as_i_z_5d_blocked, - stdlib_ndarray_i_z_as_i_z_6d_blocked, - stdlib_ndarray_i_z_as_i_z_7d_blocked, - stdlib_ndarray_i_z_as_i_z_8d_blocked, - stdlib_ndarray_i_z_as_i_z_9d_blocked, - stdlib_ndarray_i_z_as_i_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_i_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_i_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_i_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/i_z_as_z_z.c b/src/i_z_as_z_z.c deleted file mode 100644 index 640528b..0000000 --- a/src/i_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - int32_t v; - int8_t status = stdlib_ndarray_iget_int32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_int32( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int32_t, stdlib_complex128_t, stdlib_complex128_from_int32, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_i_z_as_z_z_0d, - stdlib_ndarray_i_z_as_z_z_1d, - stdlib_ndarray_i_z_as_z_z_2d, - stdlib_ndarray_i_z_as_z_z_3d, - stdlib_ndarray_i_z_as_z_z_4d, - stdlib_ndarray_i_z_as_z_z_5d, - stdlib_ndarray_i_z_as_z_z_6d, - stdlib_ndarray_i_z_as_z_z_7d, - stdlib_ndarray_i_z_as_z_z_8d, - stdlib_ndarray_i_z_as_z_z_9d, - stdlib_ndarray_i_z_as_z_z_10d, - stdlib_ndarray_i_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_i_z_as_z_z_2d_blocked, - stdlib_ndarray_i_z_as_z_z_3d_blocked, - stdlib_ndarray_i_z_as_z_z_4d_blocked, - stdlib_ndarray_i_z_as_z_z_5d_blocked, - stdlib_ndarray_i_z_as_z_z_6d_blocked, - stdlib_ndarray_i_z_as_z_z_7d_blocked, - stdlib_ndarray_i_z_as_z_z_8d_blocked, - stdlib_ndarray_i_z_as_z_z_9d_blocked, - stdlib_ndarray_i_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/i_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_i_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_i_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/internal/permute.c b/src/internal/permute.c deleted file mode 100644 index e287547..0000000 --- a/src/internal/permute.c +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary/internal/permute.h" -#include - -/** -* Permutes an input array according to a provided index array. -* -* @param n number of elements to permute -* @param arr input array -* @param idx permutation indices -* @param out output array -*/ -void stdlib_ndarray_base_unary_internal_permute( const int64_t n, const int64_t *arr, const int64_t *idx, int64_t *out ) { - int64_t i; - for ( i = 0; i < n; i++ ) { - out[ i ] = arr[ idx[i] ]; - } -} diff --git a/src/internal/range.c b/src/internal/range.c deleted file mode 100644 index badc444..0000000 --- a/src/internal/range.c +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary/internal/range.h" -#include - -/** -* Writes `n` evenly spaced values from `0` to `n-1` to an output array. -* -* @param n number of values to write -* @param out output array -*/ -void stdlib_ndarray_base_unary_internal_range( const int64_t n, int64_t *out ) { - int64_t i; - for ( i = 0; i < n; i++ ) { - out[ i ] = i; - } -} diff --git a/src/internal/sort2ins.c b/src/internal/sort2ins.c deleted file mode 100644 index bdd01bb..0000000 --- a/src/internal/sort2ins.c +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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/base/unary/internal/sort2ins.h" -#include - -/** -* Simultaneously sorts two arrays based on the sort order of the first array using insertion sort. -* -* ## Notes -* -* - The first array is sorted in increasing order according to absolute value. -* - The algorithm has space complexity `O(1)` and worst case time complexity `O(N^2)`. -* - The algorithm is efficient for small arrays (typically `N <= 20`) and is particularly efficient for sorting arrays which are already substantially sorted. -* - The algorithm is **stable**, meaning that the algorithm does **not** change the order of array elements which are equal or equivalent. -* - The input arrays are sorted in-place (i.e., the input arrays are mutated). -* -* @param n number of elements -* @param x first array -* @param y second array -*/ -void stdlib_ndarray_base_unary_internal_sort2ins( const int64_t n, int64_t *x, int64_t *y ) { - int64_t avx; - int64_t aux; - int64_t ix; - int64_t iy; - int64_t jx; - int64_t jy; - int64_t vx; - int64_t vy; - int64_t ux; - int64_t i; - - ix = 1; - iy = 1; - - // Sort in increasing order... - for ( i = 1; i < n; i++ ) { - vx = x[ ix ]; - avx = ( vx < 0 ) ? -vx : vx; - - vy = y[ iy ]; - - jx = ix - 1; - jy = iy - 1; - - // Shift all larger values to the left of the current element to the right... - while ( jx >= 0 ) { - ux = x[ jx ]; - aux = ( ux < 0 ) ? -ux : ux; - if ( aux <= avx ) { - break; - } - x[ jx+1 ] = ux; - y[ jy+1 ] = y[ jy ]; - jx -= 1; - jy -= 1; - } - x[ jx+1 ] = vx; - y[ jy+1 ] = vy; - ix += 1; - iy += 1; - } -} diff --git a/src/k_c.c b/src/k_c.c deleted file mode 100644 index e6ccfb6..0000000 --- a/src/k_c.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_int16( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_c_0d, - stdlib_ndarray_k_c_1d, - stdlib_ndarray_k_c_2d, - stdlib_ndarray_k_c_3d, - stdlib_ndarray_k_c_4d, - stdlib_ndarray_k_c_5d, - stdlib_ndarray_k_c_6d, - stdlib_ndarray_k_c_7d, - stdlib_ndarray_k_c_8d, - stdlib_ndarray_k_c_9d, - stdlib_ndarray_k_c_10d, - stdlib_ndarray_k_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_c_2d_blocked, - stdlib_ndarray_k_c_3d_blocked, - stdlib_ndarray_k_c_4d_blocked, - stdlib_ndarray_k_c_5d_blocked, - stdlib_ndarray_k_c_6d_blocked, - stdlib_ndarray_k_c_7d_blocked, - stdlib_ndarray_k_c_8d_blocked, - stdlib_ndarray_k_c_9d_blocked, - stdlib_ndarray_k_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_c_as_c_c.c b/src/k_c_as_c_c.c deleted file mode 100644 index 93fd9dc..0000000 --- a/src/k_c_as_c_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_complex64( f( stdlib_complex64_from_int16( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex64_from_int16, stdlib_complex64_from_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_c_as_c_c_0d, - stdlib_ndarray_k_c_as_c_c_1d, - stdlib_ndarray_k_c_as_c_c_2d, - stdlib_ndarray_k_c_as_c_c_3d, - stdlib_ndarray_k_c_as_c_c_4d, - stdlib_ndarray_k_c_as_c_c_5d, - stdlib_ndarray_k_c_as_c_c_6d, - stdlib_ndarray_k_c_as_c_c_7d, - stdlib_ndarray_k_c_as_c_c_8d, - stdlib_ndarray_k_c_as_c_c_9d, - stdlib_ndarray_k_c_as_c_c_10d, - stdlib_ndarray_k_c_as_c_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_c_as_c_c_2d_blocked, - stdlib_ndarray_k_c_as_c_c_3d_blocked, - stdlib_ndarray_k_c_as_c_c_4d_blocked, - stdlib_ndarray_k_c_as_c_c_5d_blocked, - stdlib_ndarray_k_c_as_c_c_6d_blocked, - stdlib_ndarray_k_c_as_c_c_7d_blocked, - stdlib_ndarray_k_c_as_c_c_8d_blocked, - stdlib_ndarray_k_c_as_c_c_9d_blocked, - stdlib_ndarray_k_c_as_c_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_c_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_c_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_c_as_k_c.c b/src/k_c_as_k_c.c deleted file mode 100644 index e945aeb..0000000 --- a/src/k_c_as_k_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex64_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_c_as_k_c_0d, - stdlib_ndarray_k_c_as_k_c_1d, - stdlib_ndarray_k_c_as_k_c_2d, - stdlib_ndarray_k_c_as_k_c_3d, - stdlib_ndarray_k_c_as_k_c_4d, - stdlib_ndarray_k_c_as_k_c_5d, - stdlib_ndarray_k_c_as_k_c_6d, - stdlib_ndarray_k_c_as_k_c_7d, - stdlib_ndarray_k_c_as_k_c_8d, - stdlib_ndarray_k_c_as_k_c_9d, - stdlib_ndarray_k_c_as_k_c_10d, - stdlib_ndarray_k_c_as_k_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_c_as_k_c_2d_blocked, - stdlib_ndarray_k_c_as_k_c_3d_blocked, - stdlib_ndarray_k_c_as_k_c_4d_blocked, - stdlib_ndarray_k_c_as_k_c_5d_blocked, - stdlib_ndarray_k_c_as_k_c_6d_blocked, - stdlib_ndarray_k_c_as_k_c_7d_blocked, - stdlib_ndarray_k_c_as_k_c_8d_blocked, - stdlib_ndarray_k_c_as_k_c_9d_blocked, - stdlib_ndarray_k_c_as_k_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_k_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_k_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_k_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_c_as_z_z.c b/src/k_c_as_z_z.c deleted file mode 100644 index eee4395..0000000 --- a/src/k_c_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex128_to_complex64( f( stdlib_complex128_from_int16( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex64_t, stdlib_complex128_from_int16, stdlib_complex128_to_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_c_as_z_z_0d, - stdlib_ndarray_k_c_as_z_z_1d, - stdlib_ndarray_k_c_as_z_z_2d, - stdlib_ndarray_k_c_as_z_z_3d, - stdlib_ndarray_k_c_as_z_z_4d, - stdlib_ndarray_k_c_as_z_z_5d, - stdlib_ndarray_k_c_as_z_z_6d, - stdlib_ndarray_k_c_as_z_z_7d, - stdlib_ndarray_k_c_as_z_z_8d, - stdlib_ndarray_k_c_as_z_z_9d, - stdlib_ndarray_k_c_as_z_z_10d, - stdlib_ndarray_k_c_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_c_as_z_z_2d_blocked, - stdlib_ndarray_k_c_as_z_z_3d_blocked, - stdlib_ndarray_k_c_as_z_z_4d_blocked, - stdlib_ndarray_k_c_as_z_z_5d_blocked, - stdlib_ndarray_k_c_as_z_z_6d_blocked, - stdlib_ndarray_k_c_as_z_z_7d_blocked, - stdlib_ndarray_k_c_as_z_z_8d_blocked, - stdlib_ndarray_k_c_as_z_z_9d_blocked, - stdlib_ndarray_k_c_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_c_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_c_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_d.c b/src/k_d.c deleted file mode 100644 index b5e6d17..0000000 --- a/src/k_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_d_0d, - stdlib_ndarray_k_d_1d, - stdlib_ndarray_k_d_2d, - stdlib_ndarray_k_d_3d, - stdlib_ndarray_k_d_4d, - stdlib_ndarray_k_d_5d, - stdlib_ndarray_k_d_6d, - stdlib_ndarray_k_d_7d, - stdlib_ndarray_k_d_8d, - stdlib_ndarray_k_d_9d, - stdlib_ndarray_k_d_10d, - stdlib_ndarray_k_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_d_2d_blocked, - stdlib_ndarray_k_d_3d_blocked, - stdlib_ndarray_k_d_4d_blocked, - stdlib_ndarray_k_d_5d_blocked, - stdlib_ndarray_k_d_6d_blocked, - stdlib_ndarray_k_d_7d_blocked, - stdlib_ndarray_k_d_8d_blocked, - stdlib_ndarray_k_d_9d_blocked, - stdlib_ndarray_k_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_d_as_d_d.c b/src/k_d_as_d_d.c deleted file mode 100644 index df58e4f..0000000 --- a/src/k_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_d_as_d_d_0d, - stdlib_ndarray_k_d_as_d_d_1d, - stdlib_ndarray_k_d_as_d_d_2d, - stdlib_ndarray_k_d_as_d_d_3d, - stdlib_ndarray_k_d_as_d_d_4d, - stdlib_ndarray_k_d_as_d_d_5d, - stdlib_ndarray_k_d_as_d_d_6d, - stdlib_ndarray_k_d_as_d_d_7d, - stdlib_ndarray_k_d_as_d_d_8d, - stdlib_ndarray_k_d_as_d_d_9d, - stdlib_ndarray_k_d_as_d_d_10d, - stdlib_ndarray_k_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_d_as_d_d_2d_blocked, - stdlib_ndarray_k_d_as_d_d_3d_blocked, - stdlib_ndarray_k_d_as_d_d_4d_blocked, - stdlib_ndarray_k_d_as_d_d_5d_blocked, - stdlib_ndarray_k_d_as_d_d_6d_blocked, - stdlib_ndarray_k_d_as_d_d_7d_blocked, - stdlib_ndarray_k_d_as_d_d_8d_blocked, - stdlib_ndarray_k_d_as_d_d_9d_blocked, - stdlib_ndarray_k_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_d_as_k_d.c b/src/k_d_as_k_d.c deleted file mode 100644 index 9461077..0000000 --- a/src/k_d_as_k_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_d_as_k_d_0d, - stdlib_ndarray_k_d_as_k_d_1d, - stdlib_ndarray_k_d_as_k_d_2d, - stdlib_ndarray_k_d_as_k_d_3d, - stdlib_ndarray_k_d_as_k_d_4d, - stdlib_ndarray_k_d_as_k_d_5d, - stdlib_ndarray_k_d_as_k_d_6d, - stdlib_ndarray_k_d_as_k_d_7d, - stdlib_ndarray_k_d_as_k_d_8d, - stdlib_ndarray_k_d_as_k_d_9d, - stdlib_ndarray_k_d_as_k_d_10d, - stdlib_ndarray_k_d_as_k_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_d_as_k_d_2d_blocked, - stdlib_ndarray_k_d_as_k_d_3d_blocked, - stdlib_ndarray_k_d_as_k_d_4d_blocked, - stdlib_ndarray_k_d_as_k_d_5d_blocked, - stdlib_ndarray_k_d_as_k_d_6d_blocked, - stdlib_ndarray_k_d_as_k_d_7d_blocked, - stdlib_ndarray_k_d_as_k_d_8d_blocked, - stdlib_ndarray_k_d_as_k_d_9d_blocked, - stdlib_ndarray_k_d_as_k_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_d_as_k_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_d_as_k_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_d_as_k_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_f.c b/src/k_f.c deleted file mode 100644 index 6f11aa1..0000000 --- a/src/k_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_f_0d, - stdlib_ndarray_k_f_1d, - stdlib_ndarray_k_f_2d, - stdlib_ndarray_k_f_3d, - stdlib_ndarray_k_f_4d, - stdlib_ndarray_k_f_5d, - stdlib_ndarray_k_f_6d, - stdlib_ndarray_k_f_7d, - stdlib_ndarray_k_f_8d, - stdlib_ndarray_k_f_9d, - stdlib_ndarray_k_f_10d, - stdlib_ndarray_k_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_f_2d_blocked, - stdlib_ndarray_k_f_3d_blocked, - stdlib_ndarray_k_f_4d_blocked, - stdlib_ndarray_k_f_5d_blocked, - stdlib_ndarray_k_f_6d_blocked, - stdlib_ndarray_k_f_7d_blocked, - stdlib_ndarray_k_f_8d_blocked, - stdlib_ndarray_k_f_9d_blocked, - stdlib_ndarray_k_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_f_as_d_d.c b/src/k_f_as_d_d.c deleted file mode 100644 index a6fb146..0000000 --- a/src/k_f_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_f_as_d_d_0d, - stdlib_ndarray_k_f_as_d_d_1d, - stdlib_ndarray_k_f_as_d_d_2d, - stdlib_ndarray_k_f_as_d_d_3d, - stdlib_ndarray_k_f_as_d_d_4d, - stdlib_ndarray_k_f_as_d_d_5d, - stdlib_ndarray_k_f_as_d_d_6d, - stdlib_ndarray_k_f_as_d_d_7d, - stdlib_ndarray_k_f_as_d_d_8d, - stdlib_ndarray_k_f_as_d_d_9d, - stdlib_ndarray_k_f_as_d_d_10d, - stdlib_ndarray_k_f_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_f_as_d_d_2d_blocked, - stdlib_ndarray_k_f_as_d_d_3d_blocked, - stdlib_ndarray_k_f_as_d_d_4d_blocked, - stdlib_ndarray_k_f_as_d_d_5d_blocked, - stdlib_ndarray_k_f_as_d_d_6d_blocked, - stdlib_ndarray_k_f_as_d_d_7d_blocked, - stdlib_ndarray_k_f_as_d_d_8d_blocked, - stdlib_ndarray_k_f_as_d_d_9d_blocked, - stdlib_ndarray_k_f_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_f_as_f_f.c b/src/k_f_as_f_f.c deleted file mode 100644 index 10d87a0..0000000 --- a/src/k_f_as_f_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (float)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, float, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_f_as_f_f_0d, - stdlib_ndarray_k_f_as_f_f_1d, - stdlib_ndarray_k_f_as_f_f_2d, - stdlib_ndarray_k_f_as_f_f_3d, - stdlib_ndarray_k_f_as_f_f_4d, - stdlib_ndarray_k_f_as_f_f_5d, - stdlib_ndarray_k_f_as_f_f_6d, - stdlib_ndarray_k_f_as_f_f_7d, - stdlib_ndarray_k_f_as_f_f_8d, - stdlib_ndarray_k_f_as_f_f_9d, - stdlib_ndarray_k_f_as_f_f_10d, - stdlib_ndarray_k_f_as_f_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_f_as_f_f_2d_blocked, - stdlib_ndarray_k_f_as_f_f_3d_blocked, - stdlib_ndarray_k_f_as_f_f_4d_blocked, - stdlib_ndarray_k_f_as_f_f_5d_blocked, - stdlib_ndarray_k_f_as_f_f_6d_blocked, - stdlib_ndarray_k_f_as_f_f_7d_blocked, - stdlib_ndarray_k_f_as_f_f_8d_blocked, - stdlib_ndarray_k_f_as_f_f_9d_blocked, - stdlib_ndarray_k_f_as_f_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_f_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_f_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_f_as_k_f.c b/src/k_f_as_k_f.c deleted file mode 100644 index 1d16c57..0000000 --- a/src/k_f_as_k_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_f_as_k_f_0d, - stdlib_ndarray_k_f_as_k_f_1d, - stdlib_ndarray_k_f_as_k_f_2d, - stdlib_ndarray_k_f_as_k_f_3d, - stdlib_ndarray_k_f_as_k_f_4d, - stdlib_ndarray_k_f_as_k_f_5d, - stdlib_ndarray_k_f_as_k_f_6d, - stdlib_ndarray_k_f_as_k_f_7d, - stdlib_ndarray_k_f_as_k_f_8d, - stdlib_ndarray_k_f_as_k_f_9d, - stdlib_ndarray_k_f_as_k_f_10d, - stdlib_ndarray_k_f_as_k_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_f_as_k_f_2d_blocked, - stdlib_ndarray_k_f_as_k_f_3d_blocked, - stdlib_ndarray_k_f_as_k_f_4d_blocked, - stdlib_ndarray_k_f_as_k_f_5d_blocked, - stdlib_ndarray_k_f_as_k_f_6d_blocked, - stdlib_ndarray_k_f_as_k_f_7d_blocked, - stdlib_ndarray_k_f_as_k_f_8d_blocked, - stdlib_ndarray_k_f_as_k_f_9d_blocked, - stdlib_ndarray_k_f_as_k_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_f_as_k_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_f_as_k_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_f_as_k_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_i.c b/src/k_i.c deleted file mode 100644 index 0d7d2a1..0000000 --- a/src/k_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_i_0d, - stdlib_ndarray_k_i_1d, - stdlib_ndarray_k_i_2d, - stdlib_ndarray_k_i_3d, - stdlib_ndarray_k_i_4d, - stdlib_ndarray_k_i_5d, - stdlib_ndarray_k_i_6d, - stdlib_ndarray_k_i_7d, - stdlib_ndarray_k_i_8d, - stdlib_ndarray_k_i_9d, - stdlib_ndarray_k_i_10d, - stdlib_ndarray_k_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_i_2d_blocked, - stdlib_ndarray_k_i_3d_blocked, - stdlib_ndarray_k_i_4d_blocked, - stdlib_ndarray_k_i_5d_blocked, - stdlib_ndarray_k_i_6d_blocked, - stdlib_ndarray_k_i_7d_blocked, - stdlib_ndarray_k_i_8d_blocked, - stdlib_ndarray_k_i_9d_blocked, - stdlib_ndarray_k_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_i_as_i_i.c b/src/k_i_as_i_i.c deleted file mode 100644 index 7528193..0000000 --- a/src/k_i_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, int32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_i_as_i_i_0d, - stdlib_ndarray_k_i_as_i_i_1d, - stdlib_ndarray_k_i_as_i_i_2d, - stdlib_ndarray_k_i_as_i_i_3d, - stdlib_ndarray_k_i_as_i_i_4d, - stdlib_ndarray_k_i_as_i_i_5d, - stdlib_ndarray_k_i_as_i_i_6d, - stdlib_ndarray_k_i_as_i_i_7d, - stdlib_ndarray_k_i_as_i_i_8d, - stdlib_ndarray_k_i_as_i_i_9d, - stdlib_ndarray_k_i_as_i_i_10d, - stdlib_ndarray_k_i_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_i_as_i_i_2d_blocked, - stdlib_ndarray_k_i_as_i_i_3d_blocked, - stdlib_ndarray_k_i_as_i_i_4d_blocked, - stdlib_ndarray_k_i_as_i_i_5d_blocked, - stdlib_ndarray_k_i_as_i_i_6d_blocked, - stdlib_ndarray_k_i_as_i_i_7d_blocked, - stdlib_ndarray_k_i_as_i_i_8d_blocked, - stdlib_ndarray_k_i_as_i_i_9d_blocked, - stdlib_ndarray_k_i_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_i_as_k_i.c b/src/k_i_as_k_i.c deleted file mode 100644 index e19ef98..0000000 --- a/src/k_i_as_k_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_i_as_k_i_0d, - stdlib_ndarray_k_i_as_k_i_1d, - stdlib_ndarray_k_i_as_k_i_2d, - stdlib_ndarray_k_i_as_k_i_3d, - stdlib_ndarray_k_i_as_k_i_4d, - stdlib_ndarray_k_i_as_k_i_5d, - stdlib_ndarray_k_i_as_k_i_6d, - stdlib_ndarray_k_i_as_k_i_7d, - stdlib_ndarray_k_i_as_k_i_8d, - stdlib_ndarray_k_i_as_k_i_9d, - stdlib_ndarray_k_i_as_k_i_10d, - stdlib_ndarray_k_i_as_k_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_i_as_k_i_2d_blocked, - stdlib_ndarray_k_i_as_k_i_3d_blocked, - stdlib_ndarray_k_i_as_k_i_4d_blocked, - stdlib_ndarray_k_i_as_k_i_5d_blocked, - stdlib_ndarray_k_i_as_k_i_6d_blocked, - stdlib_ndarray_k_i_as_k_i_7d_blocked, - stdlib_ndarray_k_i_as_k_i_8d_blocked, - stdlib_ndarray_k_i_as_k_i_9d_blocked, - stdlib_ndarray_k_i_as_k_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_i_as_k_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_i_as_k_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_i_as_k_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_k.c b/src/k_k.c deleted file mode 100644 index a926306..0000000 --- a/src/k_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_k_0d, - stdlib_ndarray_k_k_1d, - stdlib_ndarray_k_k_2d, - stdlib_ndarray_k_k_3d, - stdlib_ndarray_k_k_4d, - stdlib_ndarray_k_k_5d, - stdlib_ndarray_k_k_6d, - stdlib_ndarray_k_k_7d, - stdlib_ndarray_k_k_8d, - stdlib_ndarray_k_k_9d, - stdlib_ndarray_k_k_10d, - stdlib_ndarray_k_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_k_2d_blocked, - stdlib_ndarray_k_k_3d_blocked, - stdlib_ndarray_k_k_4d_blocked, - stdlib_ndarray_k_k_5d_blocked, - stdlib_ndarray_k_k_6d_blocked, - stdlib_ndarray_k_k_7d_blocked, - stdlib_ndarray_k_k_8d_blocked, - stdlib_ndarray_k_k_9d_blocked, - stdlib_ndarray_k_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_k_as_i_i.c b/src/k_k_as_i_i.c deleted file mode 100644 index 376d0e3..0000000 --- a/src/k_k_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, int16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_k_as_i_i_0d, - stdlib_ndarray_k_k_as_i_i_1d, - stdlib_ndarray_k_k_as_i_i_2d, - stdlib_ndarray_k_k_as_i_i_3d, - stdlib_ndarray_k_k_as_i_i_4d, - stdlib_ndarray_k_k_as_i_i_5d, - stdlib_ndarray_k_k_as_i_i_6d, - stdlib_ndarray_k_k_as_i_i_7d, - stdlib_ndarray_k_k_as_i_i_8d, - stdlib_ndarray_k_k_as_i_i_9d, - stdlib_ndarray_k_k_as_i_i_10d, - stdlib_ndarray_k_k_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_k_as_i_i_2d_blocked, - stdlib_ndarray_k_k_as_i_i_3d_blocked, - stdlib_ndarray_k_k_as_i_i_4d_blocked, - stdlib_ndarray_k_k_as_i_i_5d_blocked, - stdlib_ndarray_k_k_as_i_i_6d_blocked, - stdlib_ndarray_k_k_as_i_i_7d_blocked, - stdlib_ndarray_k_k_as_i_i_8d_blocked, - stdlib_ndarray_k_k_as_i_i_9d_blocked, - stdlib_ndarray_k_k_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_k_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_k_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_t.c b/src/k_t.c deleted file mode 100644 index c10b963..0000000 --- a/src/k_t.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_t.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, uint16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_t_0d, - stdlib_ndarray_k_t_1d, - stdlib_ndarray_k_t_2d, - stdlib_ndarray_k_t_3d, - stdlib_ndarray_k_t_4d, - stdlib_ndarray_k_t_5d, - stdlib_ndarray_k_t_6d, - stdlib_ndarray_k_t_7d, - stdlib_ndarray_k_t_8d, - stdlib_ndarray_k_t_9d, - stdlib_ndarray_k_t_10d, - stdlib_ndarray_k_t_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_t_2d_blocked, - stdlib_ndarray_k_t_3d_blocked, - stdlib_ndarray_k_t_4d_blocked, - stdlib_ndarray_k_t_5d_blocked, - stdlib_ndarray_k_t_6d_blocked, - stdlib_ndarray_k_t_7d_blocked, - stdlib_ndarray_k_t_8d_blocked, - stdlib_ndarray_k_t_9d_blocked, - stdlib_ndarray_k_t_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_t_as_i_i.c b/src/k_t_as_i_i.c deleted file mode 100644 index 390a26e..0000000 --- a/src/k_t_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, uint16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_t_as_i_i_0d, - stdlib_ndarray_k_t_as_i_i_1d, - stdlib_ndarray_k_t_as_i_i_2d, - stdlib_ndarray_k_t_as_i_i_3d, - stdlib_ndarray_k_t_as_i_i_4d, - stdlib_ndarray_k_t_as_i_i_5d, - stdlib_ndarray_k_t_as_i_i_6d, - stdlib_ndarray_k_t_as_i_i_7d, - stdlib_ndarray_k_t_as_i_i_8d, - stdlib_ndarray_k_t_as_i_i_9d, - stdlib_ndarray_k_t_as_i_i_10d, - stdlib_ndarray_k_t_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_t_as_i_i_2d_blocked, - stdlib_ndarray_k_t_as_i_i_3d_blocked, - stdlib_ndarray_k_t_as_i_i_4d_blocked, - stdlib_ndarray_k_t_as_i_i_5d_blocked, - stdlib_ndarray_k_t_as_i_i_6d_blocked, - stdlib_ndarray_k_t_as_i_i_7d_blocked, - stdlib_ndarray_k_t_as_i_i_8d_blocked, - stdlib_ndarray_k_t_as_i_i_9d_blocked, - stdlib_ndarray_k_t_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_t_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_t_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_u.c b/src/k_u.c deleted file mode 100644 index a25728e..0000000 --- a/src/k_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int16_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_u_0d, - stdlib_ndarray_k_u_1d, - stdlib_ndarray_k_u_2d, - stdlib_ndarray_k_u_3d, - stdlib_ndarray_k_u_4d, - stdlib_ndarray_k_u_5d, - stdlib_ndarray_k_u_6d, - stdlib_ndarray_k_u_7d, - stdlib_ndarray_k_u_8d, - stdlib_ndarray_k_u_9d, - stdlib_ndarray_k_u_10d, - stdlib_ndarray_k_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_u_2d_blocked, - stdlib_ndarray_k_u_3d_blocked, - stdlib_ndarray_k_u_4d_blocked, - stdlib_ndarray_k_u_5d_blocked, - stdlib_ndarray_k_u_6d_blocked, - stdlib_ndarray_k_u_7d_blocked, - stdlib_ndarray_k_u_8d_blocked, - stdlib_ndarray_k_u_9d_blocked, - stdlib_ndarray_k_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_u_as_i_i.c b/src/k_u_as_i_i.c deleted file mode 100644 index 9018bfd..0000000 --- a/src/k_u_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int16_t, uint32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_u_as_i_i_0d, - stdlib_ndarray_k_u_as_i_i_1d, - stdlib_ndarray_k_u_as_i_i_2d, - stdlib_ndarray_k_u_as_i_i_3d, - stdlib_ndarray_k_u_as_i_i_4d, - stdlib_ndarray_k_u_as_i_i_5d, - stdlib_ndarray_k_u_as_i_i_6d, - stdlib_ndarray_k_u_as_i_i_7d, - stdlib_ndarray_k_u_as_i_i_8d, - stdlib_ndarray_k_u_as_i_i_9d, - stdlib_ndarray_k_u_as_i_i_10d, - stdlib_ndarray_k_u_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_u_as_i_i_2d_blocked, - stdlib_ndarray_k_u_as_i_i_3d_blocked, - stdlib_ndarray_k_u_as_i_i_4d_blocked, - stdlib_ndarray_k_u_as_i_i_5d_blocked, - stdlib_ndarray_k_u_as_i_i_6d_blocked, - stdlib_ndarray_k_u_as_i_i_7d_blocked, - stdlib_ndarray_k_u_as_i_i_8d_blocked, - stdlib_ndarray_k_u_as_i_i_9d_blocked, - stdlib_ndarray_k_u_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_u_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_u_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_z.c b/src/k_z.c deleted file mode 100644 index 52cdf39..0000000 --- a/src/k_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_int16( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_z_0d, - stdlib_ndarray_k_z_1d, - stdlib_ndarray_k_z_2d, - stdlib_ndarray_k_z_3d, - stdlib_ndarray_k_z_4d, - stdlib_ndarray_k_z_5d, - stdlib_ndarray_k_z_6d, - stdlib_ndarray_k_z_7d, - stdlib_ndarray_k_z_8d, - stdlib_ndarray_k_z_9d, - stdlib_ndarray_k_z_10d, - stdlib_ndarray_k_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_z_2d_blocked, - stdlib_ndarray_k_z_3d_blocked, - stdlib_ndarray_k_z_4d_blocked, - stdlib_ndarray_k_z_5d_blocked, - stdlib_ndarray_k_z_6d_blocked, - stdlib_ndarray_k_z_7d_blocked, - stdlib_ndarray_k_z_8d_blocked, - stdlib_ndarray_k_z_9d_blocked, - stdlib_ndarray_k_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_z_as_k_z.c b/src/k_z_as_k_z.c deleted file mode 100644 index e565e69..0000000 --- a/src/k_z_as_k_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( int16_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_z_as_k_z_0d, - stdlib_ndarray_k_z_as_k_z_1d, - stdlib_ndarray_k_z_as_k_z_2d, - stdlib_ndarray_k_z_as_k_z_3d, - stdlib_ndarray_k_z_as_k_z_4d, - stdlib_ndarray_k_z_as_k_z_5d, - stdlib_ndarray_k_z_as_k_z_6d, - stdlib_ndarray_k_z_as_k_z_7d, - stdlib_ndarray_k_z_as_k_z_8d, - stdlib_ndarray_k_z_as_k_z_9d, - stdlib_ndarray_k_z_as_k_z_10d, - stdlib_ndarray_k_z_as_k_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_z_as_k_z_2d_blocked, - stdlib_ndarray_k_z_as_k_z_3d_blocked, - stdlib_ndarray_k_z_as_k_z_4d_blocked, - stdlib_ndarray_k_z_as_k_z_5d_blocked, - stdlib_ndarray_k_z_as_k_z_6d_blocked, - stdlib_ndarray_k_z_as_k_z_7d_blocked, - stdlib_ndarray_k_z_as_k_z_8d_blocked, - stdlib_ndarray_k_z_as_k_z_9d_blocked, - stdlib_ndarray_k_z_as_k_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_k_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_k_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_k_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/k_z_as_z_z.c b/src/k_z_as_z_z.c deleted file mode 100644 index 4afb3c3..0000000 --- a/src/k_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - int16_t v; - int8_t status = stdlib_ndarray_iget_int16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_int16( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int16_t, stdlib_complex128_t, stdlib_complex128_from_int16, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_k_z_as_z_z_0d, - stdlib_ndarray_k_z_as_z_z_1d, - stdlib_ndarray_k_z_as_z_z_2d, - stdlib_ndarray_k_z_as_z_z_3d, - stdlib_ndarray_k_z_as_z_z_4d, - stdlib_ndarray_k_z_as_z_z_5d, - stdlib_ndarray_k_z_as_z_z_6d, - stdlib_ndarray_k_z_as_z_z_7d, - stdlib_ndarray_k_z_as_z_z_8d, - stdlib_ndarray_k_z_as_z_z_9d, - stdlib_ndarray_k_z_as_z_z_10d, - stdlib_ndarray_k_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_k_z_as_z_z_2d_blocked, - stdlib_ndarray_k_z_as_z_z_3d_blocked, - stdlib_ndarray_k_z_as_z_z_4d_blocked, - stdlib_ndarray_k_z_as_z_z_5d_blocked, - stdlib_ndarray_k_z_as_z_z_6d_blocked, - stdlib_ndarray_k_z_as_z_z_7d_blocked, - stdlib_ndarray_k_z_as_z_z_8d_blocked, - stdlib_ndarray_k_z_as_z_z_9d_blocked, - stdlib_ndarray_k_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/k_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_k_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_k_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_b.c b/src/s_b.c deleted file mode 100644 index 0e3c1eb..0000000 --- a/src/s_b.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_b.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint8( arrays[ 1 ], 0, (uint8_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, uint8_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_b_0d, - stdlib_ndarray_s_b_1d, - stdlib_ndarray_s_b_2d, - stdlib_ndarray_s_b_3d, - stdlib_ndarray_s_b_4d, - stdlib_ndarray_s_b_5d, - stdlib_ndarray_s_b_6d, - stdlib_ndarray_s_b_7d, - stdlib_ndarray_s_b_8d, - stdlib_ndarray_s_b_9d, - stdlib_ndarray_s_b_10d, - stdlib_ndarray_s_b_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_b_2d_blocked, - stdlib_ndarray_s_b_3d_blocked, - stdlib_ndarray_s_b_4d_blocked, - stdlib_ndarray_s_b_5d_blocked, - stdlib_ndarray_s_b_6d_blocked, - stdlib_ndarray_s_b_7d_blocked, - stdlib_ndarray_s_b_8d_blocked, - stdlib_ndarray_s_b_9d_blocked, - stdlib_ndarray_s_b_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_b.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_b( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_b( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_c.c b/src/s_c.c deleted file mode 100644 index 541b360..0000000 --- a/src/s_c.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_int8( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_c_0d, - stdlib_ndarray_s_c_1d, - stdlib_ndarray_s_c_2d, - stdlib_ndarray_s_c_3d, - stdlib_ndarray_s_c_4d, - stdlib_ndarray_s_c_5d, - stdlib_ndarray_s_c_6d, - stdlib_ndarray_s_c_7d, - stdlib_ndarray_s_c_8d, - stdlib_ndarray_s_c_9d, - stdlib_ndarray_s_c_10d, - stdlib_ndarray_s_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_c_2d_blocked, - stdlib_ndarray_s_c_3d_blocked, - stdlib_ndarray_s_c_4d_blocked, - stdlib_ndarray_s_c_5d_blocked, - stdlib_ndarray_s_c_6d_blocked, - stdlib_ndarray_s_c_7d_blocked, - stdlib_ndarray_s_c_8d_blocked, - stdlib_ndarray_s_c_9d_blocked, - stdlib_ndarray_s_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_c_as_c_c.c b/src/s_c_as_c_c.c deleted file mode 100644 index d108ab9..0000000 --- a/src/s_c_as_c_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_complex64( f( stdlib_complex64_from_int8( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex64_from_int8, stdlib_complex64_from_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_c_as_c_c_0d, - stdlib_ndarray_s_c_as_c_c_1d, - stdlib_ndarray_s_c_as_c_c_2d, - stdlib_ndarray_s_c_as_c_c_3d, - stdlib_ndarray_s_c_as_c_c_4d, - stdlib_ndarray_s_c_as_c_c_5d, - stdlib_ndarray_s_c_as_c_c_6d, - stdlib_ndarray_s_c_as_c_c_7d, - stdlib_ndarray_s_c_as_c_c_8d, - stdlib_ndarray_s_c_as_c_c_9d, - stdlib_ndarray_s_c_as_c_c_10d, - stdlib_ndarray_s_c_as_c_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_c_as_c_c_2d_blocked, - stdlib_ndarray_s_c_as_c_c_3d_blocked, - stdlib_ndarray_s_c_as_c_c_4d_blocked, - stdlib_ndarray_s_c_as_c_c_5d_blocked, - stdlib_ndarray_s_c_as_c_c_6d_blocked, - stdlib_ndarray_s_c_as_c_c_7d_blocked, - stdlib_ndarray_s_c_as_c_c_8d_blocked, - stdlib_ndarray_s_c_as_c_c_9d_blocked, - stdlib_ndarray_s_c_as_c_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_c_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_c_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_c_as_s_c.c b/src/s_c_as_s_c.c deleted file mode 100644 index 0c066b2..0000000 --- a/src/s_c_as_s_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex64_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_c_as_s_c_0d, - stdlib_ndarray_s_c_as_s_c_1d, - stdlib_ndarray_s_c_as_s_c_2d, - stdlib_ndarray_s_c_as_s_c_3d, - stdlib_ndarray_s_c_as_s_c_4d, - stdlib_ndarray_s_c_as_s_c_5d, - stdlib_ndarray_s_c_as_s_c_6d, - stdlib_ndarray_s_c_as_s_c_7d, - stdlib_ndarray_s_c_as_s_c_8d, - stdlib_ndarray_s_c_as_s_c_9d, - stdlib_ndarray_s_c_as_s_c_10d, - stdlib_ndarray_s_c_as_s_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_c_as_s_c_2d_blocked, - stdlib_ndarray_s_c_as_s_c_3d_blocked, - stdlib_ndarray_s_c_as_s_c_4d_blocked, - stdlib_ndarray_s_c_as_s_c_5d_blocked, - stdlib_ndarray_s_c_as_s_c_6d_blocked, - stdlib_ndarray_s_c_as_s_c_7d_blocked, - stdlib_ndarray_s_c_as_s_c_8d_blocked, - stdlib_ndarray_s_c_as_s_c_9d_blocked, - stdlib_ndarray_s_c_as_s_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_s_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_s_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_s_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_c_as_z_z.c b/src/s_c_as_z_z.c deleted file mode 100644 index df1ebcf..0000000 --- a/src/s_c_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex128_to_complex64( f( stdlib_complex128_from_int8( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex64_t, stdlib_complex128_from_int8, stdlib_complex128_to_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_c_as_z_z_0d, - stdlib_ndarray_s_c_as_z_z_1d, - stdlib_ndarray_s_c_as_z_z_2d, - stdlib_ndarray_s_c_as_z_z_3d, - stdlib_ndarray_s_c_as_z_z_4d, - stdlib_ndarray_s_c_as_z_z_5d, - stdlib_ndarray_s_c_as_z_z_6d, - stdlib_ndarray_s_c_as_z_z_7d, - stdlib_ndarray_s_c_as_z_z_8d, - stdlib_ndarray_s_c_as_z_z_9d, - stdlib_ndarray_s_c_as_z_z_10d, - stdlib_ndarray_s_c_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_c_as_z_z_2d_blocked, - stdlib_ndarray_s_c_as_z_z_3d_blocked, - stdlib_ndarray_s_c_as_z_z_4d_blocked, - stdlib_ndarray_s_c_as_z_z_5d_blocked, - stdlib_ndarray_s_c_as_z_z_6d_blocked, - stdlib_ndarray_s_c_as_z_z_7d_blocked, - stdlib_ndarray_s_c_as_z_z_8d_blocked, - stdlib_ndarray_s_c_as_z_z_9d_blocked, - stdlib_ndarray_s_c_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_c_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_c_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_d.c b/src/s_d.c deleted file mode 100644 index f813efb..0000000 --- a/src/s_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_d_0d, - stdlib_ndarray_s_d_1d, - stdlib_ndarray_s_d_2d, - stdlib_ndarray_s_d_3d, - stdlib_ndarray_s_d_4d, - stdlib_ndarray_s_d_5d, - stdlib_ndarray_s_d_6d, - stdlib_ndarray_s_d_7d, - stdlib_ndarray_s_d_8d, - stdlib_ndarray_s_d_9d, - stdlib_ndarray_s_d_10d, - stdlib_ndarray_s_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_d_2d_blocked, - stdlib_ndarray_s_d_3d_blocked, - stdlib_ndarray_s_d_4d_blocked, - stdlib_ndarray_s_d_5d_blocked, - stdlib_ndarray_s_d_6d_blocked, - stdlib_ndarray_s_d_7d_blocked, - stdlib_ndarray_s_d_8d_blocked, - stdlib_ndarray_s_d_9d_blocked, - stdlib_ndarray_s_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_d_as_d_d.c b/src/s_d_as_d_d.c deleted file mode 100644 index 82a44a8..0000000 --- a/src/s_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_d_as_d_d_0d, - stdlib_ndarray_s_d_as_d_d_1d, - stdlib_ndarray_s_d_as_d_d_2d, - stdlib_ndarray_s_d_as_d_d_3d, - stdlib_ndarray_s_d_as_d_d_4d, - stdlib_ndarray_s_d_as_d_d_5d, - stdlib_ndarray_s_d_as_d_d_6d, - stdlib_ndarray_s_d_as_d_d_7d, - stdlib_ndarray_s_d_as_d_d_8d, - stdlib_ndarray_s_d_as_d_d_9d, - stdlib_ndarray_s_d_as_d_d_10d, - stdlib_ndarray_s_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_d_as_d_d_2d_blocked, - stdlib_ndarray_s_d_as_d_d_3d_blocked, - stdlib_ndarray_s_d_as_d_d_4d_blocked, - stdlib_ndarray_s_d_as_d_d_5d_blocked, - stdlib_ndarray_s_d_as_d_d_6d_blocked, - stdlib_ndarray_s_d_as_d_d_7d_blocked, - stdlib_ndarray_s_d_as_d_d_8d_blocked, - stdlib_ndarray_s_d_as_d_d_9d_blocked, - stdlib_ndarray_s_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_d_as_s_d.c b/src/s_d_as_s_d.c deleted file mode 100644 index 470643a..0000000 --- a/src/s_d_as_s_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_d_as_s_d_0d, - stdlib_ndarray_s_d_as_s_d_1d, - stdlib_ndarray_s_d_as_s_d_2d, - stdlib_ndarray_s_d_as_s_d_3d, - stdlib_ndarray_s_d_as_s_d_4d, - stdlib_ndarray_s_d_as_s_d_5d, - stdlib_ndarray_s_d_as_s_d_6d, - stdlib_ndarray_s_d_as_s_d_7d, - stdlib_ndarray_s_d_as_s_d_8d, - stdlib_ndarray_s_d_as_s_d_9d, - stdlib_ndarray_s_d_as_s_d_10d, - stdlib_ndarray_s_d_as_s_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_d_as_s_d_2d_blocked, - stdlib_ndarray_s_d_as_s_d_3d_blocked, - stdlib_ndarray_s_d_as_s_d_4d_blocked, - stdlib_ndarray_s_d_as_s_d_5d_blocked, - stdlib_ndarray_s_d_as_s_d_6d_blocked, - stdlib_ndarray_s_d_as_s_d_7d_blocked, - stdlib_ndarray_s_d_as_s_d_8d_blocked, - stdlib_ndarray_s_d_as_s_d_9d_blocked, - stdlib_ndarray_s_d_as_s_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_d_as_s_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_d_as_s_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_d_as_s_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_f.c b/src/s_f.c deleted file mode 100644 index cb137a8..0000000 --- a/src/s_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_f_0d, - stdlib_ndarray_s_f_1d, - stdlib_ndarray_s_f_2d, - stdlib_ndarray_s_f_3d, - stdlib_ndarray_s_f_4d, - stdlib_ndarray_s_f_5d, - stdlib_ndarray_s_f_6d, - stdlib_ndarray_s_f_7d, - stdlib_ndarray_s_f_8d, - stdlib_ndarray_s_f_9d, - stdlib_ndarray_s_f_10d, - stdlib_ndarray_s_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_f_2d_blocked, - stdlib_ndarray_s_f_3d_blocked, - stdlib_ndarray_s_f_4d_blocked, - stdlib_ndarray_s_f_5d_blocked, - stdlib_ndarray_s_f_6d_blocked, - stdlib_ndarray_s_f_7d_blocked, - stdlib_ndarray_s_f_8d_blocked, - stdlib_ndarray_s_f_9d_blocked, - stdlib_ndarray_s_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_f_as_d_d.c b/src/s_f_as_d_d.c deleted file mode 100644 index 670f91d..0000000 --- a/src/s_f_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_f_as_d_d_0d, - stdlib_ndarray_s_f_as_d_d_1d, - stdlib_ndarray_s_f_as_d_d_2d, - stdlib_ndarray_s_f_as_d_d_3d, - stdlib_ndarray_s_f_as_d_d_4d, - stdlib_ndarray_s_f_as_d_d_5d, - stdlib_ndarray_s_f_as_d_d_6d, - stdlib_ndarray_s_f_as_d_d_7d, - stdlib_ndarray_s_f_as_d_d_8d, - stdlib_ndarray_s_f_as_d_d_9d, - stdlib_ndarray_s_f_as_d_d_10d, - stdlib_ndarray_s_f_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_f_as_d_d_2d_blocked, - stdlib_ndarray_s_f_as_d_d_3d_blocked, - stdlib_ndarray_s_f_as_d_d_4d_blocked, - stdlib_ndarray_s_f_as_d_d_5d_blocked, - stdlib_ndarray_s_f_as_d_d_6d_blocked, - stdlib_ndarray_s_f_as_d_d_7d_blocked, - stdlib_ndarray_s_f_as_d_d_8d_blocked, - stdlib_ndarray_s_f_as_d_d_9d_blocked, - stdlib_ndarray_s_f_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_f_as_f_f.c b/src/s_f_as_f_f.c deleted file mode 100644 index 0622b79..0000000 --- a/src/s_f_as_f_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (float)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, float, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_f_as_f_f_0d, - stdlib_ndarray_s_f_as_f_f_1d, - stdlib_ndarray_s_f_as_f_f_2d, - stdlib_ndarray_s_f_as_f_f_3d, - stdlib_ndarray_s_f_as_f_f_4d, - stdlib_ndarray_s_f_as_f_f_5d, - stdlib_ndarray_s_f_as_f_f_6d, - stdlib_ndarray_s_f_as_f_f_7d, - stdlib_ndarray_s_f_as_f_f_8d, - stdlib_ndarray_s_f_as_f_f_9d, - stdlib_ndarray_s_f_as_f_f_10d, - stdlib_ndarray_s_f_as_f_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_f_as_f_f_2d_blocked, - stdlib_ndarray_s_f_as_f_f_3d_blocked, - stdlib_ndarray_s_f_as_f_f_4d_blocked, - stdlib_ndarray_s_f_as_f_f_5d_blocked, - stdlib_ndarray_s_f_as_f_f_6d_blocked, - stdlib_ndarray_s_f_as_f_f_7d_blocked, - stdlib_ndarray_s_f_as_f_f_8d_blocked, - stdlib_ndarray_s_f_as_f_f_9d_blocked, - stdlib_ndarray_s_f_as_f_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_f_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_f_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_f_as_s_f.c b/src/s_f_as_s_f.c deleted file mode 100644 index 03ab8b0..0000000 --- a/src/s_f_as_s_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_f_as_s_f_0d, - stdlib_ndarray_s_f_as_s_f_1d, - stdlib_ndarray_s_f_as_s_f_2d, - stdlib_ndarray_s_f_as_s_f_3d, - stdlib_ndarray_s_f_as_s_f_4d, - stdlib_ndarray_s_f_as_s_f_5d, - stdlib_ndarray_s_f_as_s_f_6d, - stdlib_ndarray_s_f_as_s_f_7d, - stdlib_ndarray_s_f_as_s_f_8d, - stdlib_ndarray_s_f_as_s_f_9d, - stdlib_ndarray_s_f_as_s_f_10d, - stdlib_ndarray_s_f_as_s_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_f_as_s_f_2d_blocked, - stdlib_ndarray_s_f_as_s_f_3d_blocked, - stdlib_ndarray_s_f_as_s_f_4d_blocked, - stdlib_ndarray_s_f_as_s_f_5d_blocked, - stdlib_ndarray_s_f_as_s_f_6d_blocked, - stdlib_ndarray_s_f_as_s_f_7d_blocked, - stdlib_ndarray_s_f_as_s_f_8d_blocked, - stdlib_ndarray_s_f_as_s_f_9d_blocked, - stdlib_ndarray_s_f_as_s_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_f_as_s_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_f_as_s_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_f_as_s_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_i.c b/src/s_i.c deleted file mode 100644 index 1af91a8..0000000 --- a/src/s_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_i_0d, - stdlib_ndarray_s_i_1d, - stdlib_ndarray_s_i_2d, - stdlib_ndarray_s_i_3d, - stdlib_ndarray_s_i_4d, - stdlib_ndarray_s_i_5d, - stdlib_ndarray_s_i_6d, - stdlib_ndarray_s_i_7d, - stdlib_ndarray_s_i_8d, - stdlib_ndarray_s_i_9d, - stdlib_ndarray_s_i_10d, - stdlib_ndarray_s_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_i_2d_blocked, - stdlib_ndarray_s_i_3d_blocked, - stdlib_ndarray_s_i_4d_blocked, - stdlib_ndarray_s_i_5d_blocked, - stdlib_ndarray_s_i_6d_blocked, - stdlib_ndarray_s_i_7d_blocked, - stdlib_ndarray_s_i_8d_blocked, - stdlib_ndarray_s_i_9d_blocked, - stdlib_ndarray_s_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_i_as_i_i.c b/src/s_i_as_i_i.c deleted file mode 100644 index cbe7646..0000000 --- a/src/s_i_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, int32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_i_as_i_i_0d, - stdlib_ndarray_s_i_as_i_i_1d, - stdlib_ndarray_s_i_as_i_i_2d, - stdlib_ndarray_s_i_as_i_i_3d, - stdlib_ndarray_s_i_as_i_i_4d, - stdlib_ndarray_s_i_as_i_i_5d, - stdlib_ndarray_s_i_as_i_i_6d, - stdlib_ndarray_s_i_as_i_i_7d, - stdlib_ndarray_s_i_as_i_i_8d, - stdlib_ndarray_s_i_as_i_i_9d, - stdlib_ndarray_s_i_as_i_i_10d, - stdlib_ndarray_s_i_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_i_as_i_i_2d_blocked, - stdlib_ndarray_s_i_as_i_i_3d_blocked, - stdlib_ndarray_s_i_as_i_i_4d_blocked, - stdlib_ndarray_s_i_as_i_i_5d_blocked, - stdlib_ndarray_s_i_as_i_i_6d_blocked, - stdlib_ndarray_s_i_as_i_i_7d_blocked, - stdlib_ndarray_s_i_as_i_i_8d_blocked, - stdlib_ndarray_s_i_as_i_i_9d_blocked, - stdlib_ndarray_s_i_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_i_as_s_i.c b/src/s_i_as_s_i.c deleted file mode 100644 index a41cc46..0000000 --- a/src/s_i_as_s_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_i_as_s_i_0d, - stdlib_ndarray_s_i_as_s_i_1d, - stdlib_ndarray_s_i_as_s_i_2d, - stdlib_ndarray_s_i_as_s_i_3d, - stdlib_ndarray_s_i_as_s_i_4d, - stdlib_ndarray_s_i_as_s_i_5d, - stdlib_ndarray_s_i_as_s_i_6d, - stdlib_ndarray_s_i_as_s_i_7d, - stdlib_ndarray_s_i_as_s_i_8d, - stdlib_ndarray_s_i_as_s_i_9d, - stdlib_ndarray_s_i_as_s_i_10d, - stdlib_ndarray_s_i_as_s_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_i_as_s_i_2d_blocked, - stdlib_ndarray_s_i_as_s_i_3d_blocked, - stdlib_ndarray_s_i_as_s_i_4d_blocked, - stdlib_ndarray_s_i_as_s_i_5d_blocked, - stdlib_ndarray_s_i_as_s_i_6d_blocked, - stdlib_ndarray_s_i_as_s_i_7d_blocked, - stdlib_ndarray_s_i_as_s_i_8d_blocked, - stdlib_ndarray_s_i_as_s_i_9d_blocked, - stdlib_ndarray_s_i_as_s_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_i_as_s_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_i_as_s_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_i_as_s_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_k.c b/src/s_k.c deleted file mode 100644 index 1c620c9..0000000 --- a/src/s_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_k_0d, - stdlib_ndarray_s_k_1d, - stdlib_ndarray_s_k_2d, - stdlib_ndarray_s_k_3d, - stdlib_ndarray_s_k_4d, - stdlib_ndarray_s_k_5d, - stdlib_ndarray_s_k_6d, - stdlib_ndarray_s_k_7d, - stdlib_ndarray_s_k_8d, - stdlib_ndarray_s_k_9d, - stdlib_ndarray_s_k_10d, - stdlib_ndarray_s_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_k_2d_blocked, - stdlib_ndarray_s_k_3d_blocked, - stdlib_ndarray_s_k_4d_blocked, - stdlib_ndarray_s_k_5d_blocked, - stdlib_ndarray_s_k_6d_blocked, - stdlib_ndarray_s_k_7d_blocked, - stdlib_ndarray_s_k_8d_blocked, - stdlib_ndarray_s_k_9d_blocked, - stdlib_ndarray_s_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_k_as_i_i.c b/src/s_k_as_i_i.c deleted file mode 100644 index 9a54eee..0000000 --- a/src/s_k_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_k_as_i_i_0d, - stdlib_ndarray_s_k_as_i_i_1d, - stdlib_ndarray_s_k_as_i_i_2d, - stdlib_ndarray_s_k_as_i_i_3d, - stdlib_ndarray_s_k_as_i_i_4d, - stdlib_ndarray_s_k_as_i_i_5d, - stdlib_ndarray_s_k_as_i_i_6d, - stdlib_ndarray_s_k_as_i_i_7d, - stdlib_ndarray_s_k_as_i_i_8d, - stdlib_ndarray_s_k_as_i_i_9d, - stdlib_ndarray_s_k_as_i_i_10d, - stdlib_ndarray_s_k_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_k_as_i_i_2d_blocked, - stdlib_ndarray_s_k_as_i_i_3d_blocked, - stdlib_ndarray_s_k_as_i_i_4d_blocked, - stdlib_ndarray_s_k_as_i_i_5d_blocked, - stdlib_ndarray_s_k_as_i_i_6d_blocked, - stdlib_ndarray_s_k_as_i_i_7d_blocked, - stdlib_ndarray_s_k_as_i_i_8d_blocked, - stdlib_ndarray_s_k_as_i_i_9d_blocked, - stdlib_ndarray_s_k_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_k_as_k_k.c b/src/s_k_as_k_k.c deleted file mode 100644 index 56120c8..0000000 --- a/src/s_k_as_k_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, (int16_t)f( (int16_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, int16_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_k_as_k_k_0d, - stdlib_ndarray_s_k_as_k_k_1d, - stdlib_ndarray_s_k_as_k_k_2d, - stdlib_ndarray_s_k_as_k_k_3d, - stdlib_ndarray_s_k_as_k_k_4d, - stdlib_ndarray_s_k_as_k_k_5d, - stdlib_ndarray_s_k_as_k_k_6d, - stdlib_ndarray_s_k_as_k_k_7d, - stdlib_ndarray_s_k_as_k_k_8d, - stdlib_ndarray_s_k_as_k_k_9d, - stdlib_ndarray_s_k_as_k_k_10d, - stdlib_ndarray_s_k_as_k_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_k_as_k_k_2d_blocked, - stdlib_ndarray_s_k_as_k_k_3d_blocked, - stdlib_ndarray_s_k_as_k_k_4d_blocked, - stdlib_ndarray_s_k_as_k_k_5d_blocked, - stdlib_ndarray_s_k_as_k_k_6d_blocked, - stdlib_ndarray_s_k_as_k_k_7d_blocked, - stdlib_ndarray_s_k_as_k_k_8d_blocked, - stdlib_ndarray_s_k_as_k_k_9d_blocked, - stdlib_ndarray_s_k_as_k_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_k_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_k_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_k_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_k_as_s_k.c b/src/s_k_as_s_k.c deleted file mode 100644 index 2c26bee..0000000 --- a/src/s_k_as_s_k.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int16( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_1d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_2d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_3d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_4d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_5d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_6d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_7d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_8d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_9d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_10d( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k_nd( struct ndarray *arrays[], void *fcn ) { - typedef int16_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, int16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_k_as_s_k_0d, - stdlib_ndarray_s_k_as_s_k_1d, - stdlib_ndarray_s_k_as_s_k_2d, - stdlib_ndarray_s_k_as_s_k_3d, - stdlib_ndarray_s_k_as_s_k_4d, - stdlib_ndarray_s_k_as_s_k_5d, - stdlib_ndarray_s_k_as_s_k_6d, - stdlib_ndarray_s_k_as_s_k_7d, - stdlib_ndarray_s_k_as_s_k_8d, - stdlib_ndarray_s_k_as_s_k_9d, - stdlib_ndarray_s_k_as_s_k_10d, - stdlib_ndarray_s_k_as_s_k_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_k_as_s_k_2d_blocked, - stdlib_ndarray_s_k_as_s_k_3d_blocked, - stdlib_ndarray_s_k_as_s_k_4d_blocked, - stdlib_ndarray_s_k_as_s_k_5d_blocked, - stdlib_ndarray_s_k_as_s_k_6d_blocked, - stdlib_ndarray_s_k_as_s_k_7d_blocked, - stdlib_ndarray_s_k_as_s_k_8d_blocked, - stdlib_ndarray_s_k_as_s_k_9d_blocked, - stdlib_ndarray_s_k_as_s_k_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_k_as_s_k.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int16_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_k_as_s_k( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_k_as_s_k( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_s.c b/src/s_s.c deleted file mode 100644 index 99b6b27..0000000 --- a/src/s_s.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_s.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int8( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, int8_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_s_0d, - stdlib_ndarray_s_s_1d, - stdlib_ndarray_s_s_2d, - stdlib_ndarray_s_s_3d, - stdlib_ndarray_s_s_4d, - stdlib_ndarray_s_s_5d, - stdlib_ndarray_s_s_6d, - stdlib_ndarray_s_s_7d, - stdlib_ndarray_s_s_8d, - stdlib_ndarray_s_s_9d, - stdlib_ndarray_s_s_10d, - stdlib_ndarray_s_s_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_s_2d_blocked, - stdlib_ndarray_s_s_3d_blocked, - stdlib_ndarray_s_s_4d_blocked, - stdlib_ndarray_s_s_5d_blocked, - stdlib_ndarray_s_s_6d_blocked, - stdlib_ndarray_s_s_7d_blocked, - stdlib_ndarray_s_s_8d_blocked, - stdlib_ndarray_s_s_9d_blocked, - stdlib_ndarray_s_s_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_s_as_i_i.c b/src/s_s_as_i_i.c deleted file mode 100644 index d79e86c..0000000 --- a/src/s_s_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int8( arrays[ 1 ], 0, (int8_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, int8_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_s_as_i_i_0d, - stdlib_ndarray_s_s_as_i_i_1d, - stdlib_ndarray_s_s_as_i_i_2d, - stdlib_ndarray_s_s_as_i_i_3d, - stdlib_ndarray_s_s_as_i_i_4d, - stdlib_ndarray_s_s_as_i_i_5d, - stdlib_ndarray_s_s_as_i_i_6d, - stdlib_ndarray_s_s_as_i_i_7d, - stdlib_ndarray_s_s_as_i_i_8d, - stdlib_ndarray_s_s_as_i_i_9d, - stdlib_ndarray_s_s_as_i_i_10d, - stdlib_ndarray_s_s_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_s_as_i_i_2d_blocked, - stdlib_ndarray_s_s_as_i_i_3d_blocked, - stdlib_ndarray_s_s_as_i_i_4d_blocked, - stdlib_ndarray_s_s_as_i_i_5d_blocked, - stdlib_ndarray_s_s_as_i_i_6d_blocked, - stdlib_ndarray_s_s_as_i_i_7d_blocked, - stdlib_ndarray_s_s_as_i_i_8d_blocked, - stdlib_ndarray_s_s_as_i_i_9d_blocked, - stdlib_ndarray_s_s_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_s_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT8; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_s_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_s_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_t.c b/src/s_t.c deleted file mode 100644 index 2438feb..0000000 --- a/src/s_t.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_t.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, uint16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_t_0d, - stdlib_ndarray_s_t_1d, - stdlib_ndarray_s_t_2d, - stdlib_ndarray_s_t_3d, - stdlib_ndarray_s_t_4d, - stdlib_ndarray_s_t_5d, - stdlib_ndarray_s_t_6d, - stdlib_ndarray_s_t_7d, - stdlib_ndarray_s_t_8d, - stdlib_ndarray_s_t_9d, - stdlib_ndarray_s_t_10d, - stdlib_ndarray_s_t_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_t_2d_blocked, - stdlib_ndarray_s_t_3d_blocked, - stdlib_ndarray_s_t_4d_blocked, - stdlib_ndarray_s_t_5d_blocked, - stdlib_ndarray_s_t_6d_blocked, - stdlib_ndarray_s_t_7d_blocked, - stdlib_ndarray_s_t_8d_blocked, - stdlib_ndarray_s_t_9d_blocked, - stdlib_ndarray_s_t_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_t_as_i_i.c b/src/s_t_as_i_i.c deleted file mode 100644 index 246deaf..0000000 --- a/src/s_t_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, uint16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_t_as_i_i_0d, - stdlib_ndarray_s_t_as_i_i_1d, - stdlib_ndarray_s_t_as_i_i_2d, - stdlib_ndarray_s_t_as_i_i_3d, - stdlib_ndarray_s_t_as_i_i_4d, - stdlib_ndarray_s_t_as_i_i_5d, - stdlib_ndarray_s_t_as_i_i_6d, - stdlib_ndarray_s_t_as_i_i_7d, - stdlib_ndarray_s_t_as_i_i_8d, - stdlib_ndarray_s_t_as_i_i_9d, - stdlib_ndarray_s_t_as_i_i_10d, - stdlib_ndarray_s_t_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_t_as_i_i_2d_blocked, - stdlib_ndarray_s_t_as_i_i_3d_blocked, - stdlib_ndarray_s_t_as_i_i_4d_blocked, - stdlib_ndarray_s_t_as_i_i_5d_blocked, - stdlib_ndarray_s_t_as_i_i_6d_blocked, - stdlib_ndarray_s_t_as_i_i_7d_blocked, - stdlib_ndarray_s_t_as_i_i_8d_blocked, - stdlib_ndarray_s_t_as_i_i_9d_blocked, - stdlib_ndarray_s_t_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_t_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_t_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_t_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_u.c b/src/s_u.c deleted file mode 100644 index 5cba798..0000000 --- a/src/s_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( int8_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_u_0d, - stdlib_ndarray_s_u_1d, - stdlib_ndarray_s_u_2d, - stdlib_ndarray_s_u_3d, - stdlib_ndarray_s_u_4d, - stdlib_ndarray_s_u_5d, - stdlib_ndarray_s_u_6d, - stdlib_ndarray_s_u_7d, - stdlib_ndarray_s_u_8d, - stdlib_ndarray_s_u_9d, - stdlib_ndarray_s_u_10d, - stdlib_ndarray_s_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_u_2d_blocked, - stdlib_ndarray_s_u_3d_blocked, - stdlib_ndarray_s_u_4d_blocked, - stdlib_ndarray_s_u_5d_blocked, - stdlib_ndarray_s_u_6d_blocked, - stdlib_ndarray_s_u_7d_blocked, - stdlib_ndarray_s_u_8d_blocked, - stdlib_ndarray_s_u_9d_blocked, - stdlib_ndarray_s_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_u_as_i_i.c b/src/s_u_as_i_i.c deleted file mode 100644 index dc9a5ae..0000000 --- a/src/s_u_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( int8_t, uint32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_u_as_i_i_0d, - stdlib_ndarray_s_u_as_i_i_1d, - stdlib_ndarray_s_u_as_i_i_2d, - stdlib_ndarray_s_u_as_i_i_3d, - stdlib_ndarray_s_u_as_i_i_4d, - stdlib_ndarray_s_u_as_i_i_5d, - stdlib_ndarray_s_u_as_i_i_6d, - stdlib_ndarray_s_u_as_i_i_7d, - stdlib_ndarray_s_u_as_i_i_8d, - stdlib_ndarray_s_u_as_i_i_9d, - stdlib_ndarray_s_u_as_i_i_10d, - stdlib_ndarray_s_u_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_u_as_i_i_2d_blocked, - stdlib_ndarray_s_u_as_i_i_3d_blocked, - stdlib_ndarray_s_u_as_i_i_4d_blocked, - stdlib_ndarray_s_u_as_i_i_5d_blocked, - stdlib_ndarray_s_u_as_i_i_6d_blocked, - stdlib_ndarray_s_u_as_i_i_7d_blocked, - stdlib_ndarray_s_u_as_i_i_8d_blocked, - stdlib_ndarray_s_u_as_i_i_9d_blocked, - stdlib_ndarray_s_u_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_u_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_u_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_u_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_z.c b/src/s_z.c deleted file mode 100644 index 8b29925..0000000 --- a/src/s_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_int8( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef int8_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_z_0d, - stdlib_ndarray_s_z_1d, - stdlib_ndarray_s_z_2d, - stdlib_ndarray_s_z_3d, - stdlib_ndarray_s_z_4d, - stdlib_ndarray_s_z_5d, - stdlib_ndarray_s_z_6d, - stdlib_ndarray_s_z_7d, - stdlib_ndarray_s_z_8d, - stdlib_ndarray_s_z_9d, - stdlib_ndarray_s_z_10d, - stdlib_ndarray_s_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_z_2d_blocked, - stdlib_ndarray_s_z_3d_blocked, - stdlib_ndarray_s_z_4d_blocked, - stdlib_ndarray_s_z_5d_blocked, - stdlib_ndarray_s_z_6d_blocked, - stdlib_ndarray_s_z_7d_blocked, - stdlib_ndarray_s_z_8d_blocked, - stdlib_ndarray_s_z_9d_blocked, - stdlib_ndarray_s_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int8_t fcn( const int8_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_z_as_s_z.c b/src/s_z_as_s_z.c deleted file mode 100644 index 70d4b06..0000000 --- a/src/s_z_as_s_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const int8_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( int8_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_z_as_s_z_0d, - stdlib_ndarray_s_z_as_s_z_1d, - stdlib_ndarray_s_z_as_s_z_2d, - stdlib_ndarray_s_z_as_s_z_3d, - stdlib_ndarray_s_z_as_s_z_4d, - stdlib_ndarray_s_z_as_s_z_5d, - stdlib_ndarray_s_z_as_s_z_6d, - stdlib_ndarray_s_z_as_s_z_7d, - stdlib_ndarray_s_z_as_s_z_8d, - stdlib_ndarray_s_z_as_s_z_9d, - stdlib_ndarray_s_z_as_s_z_10d, - stdlib_ndarray_s_z_as_s_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_z_as_s_z_2d_blocked, - stdlib_ndarray_s_z_as_s_z_3d_blocked, - stdlib_ndarray_s_z_as_s_z_4d_blocked, - stdlib_ndarray_s_z_as_s_z_5d_blocked, - stdlib_ndarray_s_z_as_s_z_6d_blocked, - stdlib_ndarray_s_z_as_s_z_7d_blocked, - stdlib_ndarray_s_z_as_s_z_8d_blocked, - stdlib_ndarray_s_z_as_s_z_9d_blocked, - stdlib_ndarray_s_z_as_s_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_s_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const int8_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_s_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_s_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/s_z_as_z_z.c b/src/s_z_as_z_z.c deleted file mode 100644 index 32497e8..0000000 --- a/src/s_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - int8_t v; - int8_t status = stdlib_ndarray_iget_int8( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_int8( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( int8_t, stdlib_complex128_t, stdlib_complex128_from_int8, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_s_z_as_z_z_0d, - stdlib_ndarray_s_z_as_z_z_1d, - stdlib_ndarray_s_z_as_z_z_2d, - stdlib_ndarray_s_z_as_z_z_3d, - stdlib_ndarray_s_z_as_z_z_4d, - stdlib_ndarray_s_z_as_z_z_5d, - stdlib_ndarray_s_z_as_z_z_6d, - stdlib_ndarray_s_z_as_z_z_7d, - stdlib_ndarray_s_z_as_z_z_8d, - stdlib_ndarray_s_z_as_z_z_9d, - stdlib_ndarray_s_z_as_z_z_10d, - stdlib_ndarray_s_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_s_z_as_z_z_2d_blocked, - stdlib_ndarray_s_z_as_z_z_3d_blocked, - stdlib_ndarray_s_z_as_z_z_4d_blocked, - stdlib_ndarray_s_z_as_z_z_5d_blocked, - stdlib_ndarray_s_z_as_z_z_6d_blocked, - stdlib_ndarray_s_z_as_z_z_7d_blocked, - stdlib_ndarray_s_z_as_z_z_8d_blocked, - stdlib_ndarray_s_z_as_z_z_9d_blocked, - stdlib_ndarray_s_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/s_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_INT8; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_s_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_s_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_c.c b/src/t_c.c deleted file mode 100644 index 7ee47c9..0000000 --- a/src/t_c.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_uint16( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_c_0d, - stdlib_ndarray_t_c_1d, - stdlib_ndarray_t_c_2d, - stdlib_ndarray_t_c_3d, - stdlib_ndarray_t_c_4d, - stdlib_ndarray_t_c_5d, - stdlib_ndarray_t_c_6d, - stdlib_ndarray_t_c_7d, - stdlib_ndarray_t_c_8d, - stdlib_ndarray_t_c_9d, - stdlib_ndarray_t_c_10d, - stdlib_ndarray_t_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_c_2d_blocked, - stdlib_ndarray_t_c_3d_blocked, - stdlib_ndarray_t_c_4d_blocked, - stdlib_ndarray_t_c_5d_blocked, - stdlib_ndarray_t_c_6d_blocked, - stdlib_ndarray_t_c_7d_blocked, - stdlib_ndarray_t_c_8d_blocked, - stdlib_ndarray_t_c_9d_blocked, - stdlib_ndarray_t_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_c_as_c_c.c b/src/t_c_as_c_c.c deleted file mode 100644 index 1c7cae6..0000000 --- a/src/t_c_as_c_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex64_from_complex64( f( stdlib_complex64_from_uint16( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const stdlib_complex64_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex64_from_uint16, stdlib_complex64_from_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_c_as_c_c_0d, - stdlib_ndarray_t_c_as_c_c_1d, - stdlib_ndarray_t_c_as_c_c_2d, - stdlib_ndarray_t_c_as_c_c_3d, - stdlib_ndarray_t_c_as_c_c_4d, - stdlib_ndarray_t_c_as_c_c_5d, - stdlib_ndarray_t_c_as_c_c_6d, - stdlib_ndarray_t_c_as_c_c_7d, - stdlib_ndarray_t_c_as_c_c_8d, - stdlib_ndarray_t_c_as_c_c_9d, - stdlib_ndarray_t_c_as_c_c_10d, - stdlib_ndarray_t_c_as_c_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_c_as_c_c_2d_blocked, - stdlib_ndarray_t_c_as_c_c_3d_blocked, - stdlib_ndarray_t_c_as_c_c_4d_blocked, - stdlib_ndarray_t_c_as_c_c_5d_blocked, - stdlib_ndarray_t_c_as_c_c_6d_blocked, - stdlib_ndarray_t_c_as_c_c_7d_blocked, - stdlib_ndarray_t_c_as_c_c_8d_blocked, - stdlib_ndarray_t_c_as_c_c_9d_blocked, - stdlib_ndarray_t_c_as_c_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_c_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const stdlib_complex64_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_c_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_c_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_c_as_t_c.c b/src/t_c_as_t_c.c deleted file mode 100644 index 0c51092..0000000 --- a/src/t_c_as_t_c.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex64_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex64_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_c_as_t_c_0d, - stdlib_ndarray_t_c_as_t_c_1d, - stdlib_ndarray_t_c_as_t_c_2d, - stdlib_ndarray_t_c_as_t_c_3d, - stdlib_ndarray_t_c_as_t_c_4d, - stdlib_ndarray_t_c_as_t_c_5d, - stdlib_ndarray_t_c_as_t_c_6d, - stdlib_ndarray_t_c_as_t_c_7d, - stdlib_ndarray_t_c_as_t_c_8d, - stdlib_ndarray_t_c_as_t_c_9d, - stdlib_ndarray_t_c_as_t_c_10d, - stdlib_ndarray_t_c_as_t_c_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_c_as_t_c_2d_blocked, - stdlib_ndarray_t_c_as_t_c_3d_blocked, - stdlib_ndarray_t_c_as_t_c_4d_blocked, - stdlib_ndarray_t_c_as_t_c_5d_blocked, - stdlib_ndarray_t_c_as_t_c_6d_blocked, - stdlib_ndarray_t_c_as_t_c_7d_blocked, - stdlib_ndarray_t_c_as_t_c_8d_blocked, - stdlib_ndarray_t_c_as_t_c_9d_blocked, - stdlib_ndarray_t_c_as_t_c_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_t_c.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float32/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex64_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_t_c( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_t_c( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_c_as_z_z.c b/src/t_c_as_z_z.c deleted file mode 100644 index cddeedd..0000000 --- a/src/t_c_as_z_z.c +++ /dev/null @@ -1,2192 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float32/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex64( arrays[ 1 ], 0, stdlib_complex128_to_complex64( f( stdlib_complex128_from_uint16( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex64_t, stdlib_complex128_from_uint16, stdlib_complex128_to_complex64 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_c_as_z_z_0d, - stdlib_ndarray_t_c_as_z_z_1d, - stdlib_ndarray_t_c_as_z_z_2d, - stdlib_ndarray_t_c_as_z_z_3d, - stdlib_ndarray_t_c_as_z_z_4d, - stdlib_ndarray_t_c_as_z_z_5d, - stdlib_ndarray_t_c_as_z_z_6d, - stdlib_ndarray_t_c_as_z_z_7d, - stdlib_ndarray_t_c_as_z_z_8d, - stdlib_ndarray_t_c_as_z_z_9d, - stdlib_ndarray_t_c_as_z_z_10d, - stdlib_ndarray_t_c_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_c_as_z_z_2d_blocked, - stdlib_ndarray_t_c_as_z_z_3d_blocked, - stdlib_ndarray_t_c_as_z_z_4d_blocked, - stdlib_ndarray_t_c_as_z_z_5d_blocked, - stdlib_ndarray_t_c_as_z_z_6d_blocked, - stdlib_ndarray_t_c_as_z_z_7d_blocked, - stdlib_ndarray_t_c_as_z_z_8d_blocked, - stdlib_ndarray_t_c_as_z_z_9d_blocked, - stdlib_ndarray_t_c_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_c_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_c_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_c_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_d.c b/src/t_d.c deleted file mode 100644 index 9824b25..0000000 --- a/src/t_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_d_0d, - stdlib_ndarray_t_d_1d, - stdlib_ndarray_t_d_2d, - stdlib_ndarray_t_d_3d, - stdlib_ndarray_t_d_4d, - stdlib_ndarray_t_d_5d, - stdlib_ndarray_t_d_6d, - stdlib_ndarray_t_d_7d, - stdlib_ndarray_t_d_8d, - stdlib_ndarray_t_d_9d, - stdlib_ndarray_t_d_10d, - stdlib_ndarray_t_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_d_2d_blocked, - stdlib_ndarray_t_d_3d_blocked, - stdlib_ndarray_t_d_4d_blocked, - stdlib_ndarray_t_d_5d_blocked, - stdlib_ndarray_t_d_6d_blocked, - stdlib_ndarray_t_d_7d_blocked, - stdlib_ndarray_t_d_8d_blocked, - stdlib_ndarray_t_d_9d_blocked, - stdlib_ndarray_t_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_d_as_d_d.c b/src/t_d_as_d_d.c deleted file mode 100644 index 17a51f3..0000000 --- a/src/t_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint16_t, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_d_as_d_d_0d, - stdlib_ndarray_t_d_as_d_d_1d, - stdlib_ndarray_t_d_as_d_d_2d, - stdlib_ndarray_t_d_as_d_d_3d, - stdlib_ndarray_t_d_as_d_d_4d, - stdlib_ndarray_t_d_as_d_d_5d, - stdlib_ndarray_t_d_as_d_d_6d, - stdlib_ndarray_t_d_as_d_d_7d, - stdlib_ndarray_t_d_as_d_d_8d, - stdlib_ndarray_t_d_as_d_d_9d, - stdlib_ndarray_t_d_as_d_d_10d, - stdlib_ndarray_t_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_d_as_d_d_2d_blocked, - stdlib_ndarray_t_d_as_d_d_3d_blocked, - stdlib_ndarray_t_d_as_d_d_4d_blocked, - stdlib_ndarray_t_d_as_d_d_5d_blocked, - stdlib_ndarray_t_d_as_d_d_6d_blocked, - stdlib_ndarray_t_d_as_d_d_7d_blocked, - stdlib_ndarray_t_d_as_d_d_8d_blocked, - stdlib_ndarray_t_d_as_d_d_9d_blocked, - stdlib_ndarray_t_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_d_as_t_d.c b/src/t_d_as_t_d.c deleted file mode 100644 index e95f4bc..0000000 --- a/src/t_d_as_t_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_d_as_t_d_0d, - stdlib_ndarray_t_d_as_t_d_1d, - stdlib_ndarray_t_d_as_t_d_2d, - stdlib_ndarray_t_d_as_t_d_3d, - stdlib_ndarray_t_d_as_t_d_4d, - stdlib_ndarray_t_d_as_t_d_5d, - stdlib_ndarray_t_d_as_t_d_6d, - stdlib_ndarray_t_d_as_t_d_7d, - stdlib_ndarray_t_d_as_t_d_8d, - stdlib_ndarray_t_d_as_t_d_9d, - stdlib_ndarray_t_d_as_t_d_10d, - stdlib_ndarray_t_d_as_t_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_d_as_t_d_2d_blocked, - stdlib_ndarray_t_d_as_t_d_3d_blocked, - stdlib_ndarray_t_d_as_t_d_4d_blocked, - stdlib_ndarray_t_d_as_t_d_5d_blocked, - stdlib_ndarray_t_d_as_t_d_6d_blocked, - stdlib_ndarray_t_d_as_t_d_7d_blocked, - stdlib_ndarray_t_d_as_t_d_8d_blocked, - stdlib_ndarray_t_d_as_t_d_9d_blocked, - stdlib_ndarray_t_d_as_t_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_d_as_t_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_d_as_t_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_d_as_t_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_f.c b/src/t_f.c deleted file mode 100644 index 4efcdfc..0000000 --- a/src/t_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_f_0d, - stdlib_ndarray_t_f_1d, - stdlib_ndarray_t_f_2d, - stdlib_ndarray_t_f_3d, - stdlib_ndarray_t_f_4d, - stdlib_ndarray_t_f_5d, - stdlib_ndarray_t_f_6d, - stdlib_ndarray_t_f_7d, - stdlib_ndarray_t_f_8d, - stdlib_ndarray_t_f_9d, - stdlib_ndarray_t_f_10d, - stdlib_ndarray_t_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_f_2d_blocked, - stdlib_ndarray_t_f_3d_blocked, - stdlib_ndarray_t_f_4d_blocked, - stdlib_ndarray_t_f_5d_blocked, - stdlib_ndarray_t_f_6d_blocked, - stdlib_ndarray_t_f_7d_blocked, - stdlib_ndarray_t_f_8d_blocked, - stdlib_ndarray_t_f_9d_blocked, - stdlib_ndarray_t_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_f_as_d_d.c b/src/t_f_as_d_d.c deleted file mode 100644 index 222e12f..0000000 --- a/src/t_f_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint16_t, float, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_f_as_d_d_0d, - stdlib_ndarray_t_f_as_d_d_1d, - stdlib_ndarray_t_f_as_d_d_2d, - stdlib_ndarray_t_f_as_d_d_3d, - stdlib_ndarray_t_f_as_d_d_4d, - stdlib_ndarray_t_f_as_d_d_5d, - stdlib_ndarray_t_f_as_d_d_6d, - stdlib_ndarray_t_f_as_d_d_7d, - stdlib_ndarray_t_f_as_d_d_8d, - stdlib_ndarray_t_f_as_d_d_9d, - stdlib_ndarray_t_f_as_d_d_10d, - stdlib_ndarray_t_f_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_f_as_d_d_2d_blocked, - stdlib_ndarray_t_f_as_d_d_3d_blocked, - stdlib_ndarray_t_f_as_d_d_4d_blocked, - stdlib_ndarray_t_f_as_d_d_5d_blocked, - stdlib_ndarray_t_f_as_d_d_6d_blocked, - stdlib_ndarray_t_f_as_d_d_7d_blocked, - stdlib_ndarray_t_f_as_d_d_8d_blocked, - stdlib_ndarray_t_f_as_d_d_9d_blocked, - stdlib_ndarray_t_f_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_f_as_f_f.c b/src/t_f_as_f_f.c deleted file mode 100644 index c49003e..0000000 --- a/src/t_f_as_f_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, (float)f( (float)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const float x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint16_t, float, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_f_as_f_f_0d, - stdlib_ndarray_t_f_as_f_f_1d, - stdlib_ndarray_t_f_as_f_f_2d, - stdlib_ndarray_t_f_as_f_f_3d, - stdlib_ndarray_t_f_as_f_f_4d, - stdlib_ndarray_t_f_as_f_f_5d, - stdlib_ndarray_t_f_as_f_f_6d, - stdlib_ndarray_t_f_as_f_f_7d, - stdlib_ndarray_t_f_as_f_f_8d, - stdlib_ndarray_t_f_as_f_f_9d, - stdlib_ndarray_t_f_as_f_f_10d, - stdlib_ndarray_t_f_as_f_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_f_as_f_f_2d_blocked, - stdlib_ndarray_t_f_as_f_f_3d_blocked, - stdlib_ndarray_t_f_as_f_f_4d_blocked, - stdlib_ndarray_t_f_as_f_f_5d_blocked, - stdlib_ndarray_t_f_as_f_f_6d_blocked, - stdlib_ndarray_t_f_as_f_f_7d_blocked, - stdlib_ndarray_t_f_as_f_f_8d_blocked, - stdlib_ndarray_t_f_as_f_f_9d_blocked, - stdlib_ndarray_t_f_as_f_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_f_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const float x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_f_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_f_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_f_as_t_f.c b/src/t_f_as_t_f.c deleted file mode 100644 index de8b3fc..0000000 --- a/src/t_f_as_t_f.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_1d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_2d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_3d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_4d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_5d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_6d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_7d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_8d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_9d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_10d( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, float ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f_nd( struct ndarray *arrays[], void *fcn ) { - typedef float func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, float ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_f_as_t_f_0d, - stdlib_ndarray_t_f_as_t_f_1d, - stdlib_ndarray_t_f_as_t_f_2d, - stdlib_ndarray_t_f_as_t_f_3d, - stdlib_ndarray_t_f_as_t_f_4d, - stdlib_ndarray_t_f_as_t_f_5d, - stdlib_ndarray_t_f_as_t_f_6d, - stdlib_ndarray_t_f_as_t_f_7d, - stdlib_ndarray_t_f_as_t_f_8d, - stdlib_ndarray_t_f_as_t_f_9d, - stdlib_ndarray_t_f_as_t_f_10d, - stdlib_ndarray_t_f_as_t_f_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_f_as_t_f_2d_blocked, - stdlib_ndarray_t_f_as_t_f_3d_blocked, - stdlib_ndarray_t_f_as_t_f_4d_blocked, - stdlib_ndarray_t_f_as_t_f_5d_blocked, - stdlib_ndarray_t_f_as_t_f_6d_blocked, - stdlib_ndarray_t_f_as_t_f_7d_blocked, - stdlib_ndarray_t_f_as_t_f_8d_blocked, - stdlib_ndarray_t_f_as_t_f_9d_blocked, - stdlib_ndarray_t_f_as_t_f_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_f_as_t_f.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static float fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_f_as_t_f( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_f_as_t_f( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_i.c b/src/t_i.c deleted file mode 100644 index f8f7e4b..0000000 --- a/src/t_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_i_0d, - stdlib_ndarray_t_i_1d, - stdlib_ndarray_t_i_2d, - stdlib_ndarray_t_i_3d, - stdlib_ndarray_t_i_4d, - stdlib_ndarray_t_i_5d, - stdlib_ndarray_t_i_6d, - stdlib_ndarray_t_i_7d, - stdlib_ndarray_t_i_8d, - stdlib_ndarray_t_i_9d, - stdlib_ndarray_t_i_10d, - stdlib_ndarray_t_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_i_2d_blocked, - stdlib_ndarray_t_i_3d_blocked, - stdlib_ndarray_t_i_4d_blocked, - stdlib_ndarray_t_i_5d_blocked, - stdlib_ndarray_t_i_6d_blocked, - stdlib_ndarray_t_i_7d_blocked, - stdlib_ndarray_t_i_8d_blocked, - stdlib_ndarray_t_i_9d_blocked, - stdlib_ndarray_t_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_i_as_i_i.c b/src/t_i_as_i_i.c deleted file mode 100644 index c2feddb..0000000 --- a/src/t_i_as_i_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, (int32_t)f( (int32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const int32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint16_t, int32_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_i_as_i_i_0d, - stdlib_ndarray_t_i_as_i_i_1d, - stdlib_ndarray_t_i_as_i_i_2d, - stdlib_ndarray_t_i_as_i_i_3d, - stdlib_ndarray_t_i_as_i_i_4d, - stdlib_ndarray_t_i_as_i_i_5d, - stdlib_ndarray_t_i_as_i_i_6d, - stdlib_ndarray_t_i_as_i_i_7d, - stdlib_ndarray_t_i_as_i_i_8d, - stdlib_ndarray_t_i_as_i_i_9d, - stdlib_ndarray_t_i_as_i_i_10d, - stdlib_ndarray_t_i_as_i_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_i_as_i_i_2d_blocked, - stdlib_ndarray_t_i_as_i_i_3d_blocked, - stdlib_ndarray_t_i_as_i_i_4d_blocked, - stdlib_ndarray_t_i_as_i_i_5d_blocked, - stdlib_ndarray_t_i_as_i_i_6d_blocked, - stdlib_ndarray_t_i_as_i_i_7d_blocked, - stdlib_ndarray_t_i_as_i_i_8d_blocked, - stdlib_ndarray_t_i_as_i_i_9d_blocked, - stdlib_ndarray_t_i_as_i_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_i_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const int32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_i_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_i_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_i_as_t_i.c b/src/t_i_as_t_i.c deleted file mode 100644 index f35b715..0000000 --- a/src/t_i_as_t_i.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_int32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_1d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_2d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_3d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_4d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_5d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_6d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_7d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_8d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_9d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_10d( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i_nd( struct ndarray *arrays[], void *fcn ) { - typedef int32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, int32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_i_as_t_i_0d, - stdlib_ndarray_t_i_as_t_i_1d, - stdlib_ndarray_t_i_as_t_i_2d, - stdlib_ndarray_t_i_as_t_i_3d, - stdlib_ndarray_t_i_as_t_i_4d, - stdlib_ndarray_t_i_as_t_i_5d, - stdlib_ndarray_t_i_as_t_i_6d, - stdlib_ndarray_t_i_as_t_i_7d, - stdlib_ndarray_t_i_as_t_i_8d, - stdlib_ndarray_t_i_as_t_i_9d, - stdlib_ndarray_t_i_as_t_i_10d, - stdlib_ndarray_t_i_as_t_i_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_i_as_t_i_2d_blocked, - stdlib_ndarray_t_i_as_t_i_3d_blocked, - stdlib_ndarray_t_i_as_t_i_4d_blocked, - stdlib_ndarray_t_i_as_t_i_5d_blocked, - stdlib_ndarray_t_i_as_t_i_6d_blocked, - stdlib_ndarray_t_i_as_t_i_7d_blocked, - stdlib_ndarray_t_i_as_t_i_8d_blocked, - stdlib_ndarray_t_i_as_t_i_9d_blocked, - stdlib_ndarray_t_i_as_t_i_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_i_as_t_i.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_INT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static int32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_i_as_t_i( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_i_as_t_i( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_t.c b/src/t_t.c deleted file mode 100644 index c305b89..0000000 --- a/src/t_t.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_t.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, uint16_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_t_0d, - stdlib_ndarray_t_t_1d, - stdlib_ndarray_t_t_2d, - stdlib_ndarray_t_t_3d, - stdlib_ndarray_t_t_4d, - stdlib_ndarray_t_t_5d, - stdlib_ndarray_t_t_6d, - stdlib_ndarray_t_t_7d, - stdlib_ndarray_t_t_8d, - stdlib_ndarray_t_t_9d, - stdlib_ndarray_t_t_10d, - stdlib_ndarray_t_t_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_t_2d_blocked, - stdlib_ndarray_t_t_3d_blocked, - stdlib_ndarray_t_t_4d_blocked, - stdlib_ndarray_t_t_5d_blocked, - stdlib_ndarray_t_t_6d_blocked, - stdlib_ndarray_t_t_7d_blocked, - stdlib_ndarray_t_t_8d_blocked, - stdlib_ndarray_t_t_9d_blocked, - stdlib_ndarray_t_t_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_t_as_u_u.c b/src/t_t_as_u_u.c deleted file mode 100644 index 85ef5a9..0000000 --- a/src/t_t_as_u_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint16( arrays[ 1 ], 0, (uint16_t)f( (uint32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 8, 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint16_t, uint16_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_t_as_u_u_0d, - stdlib_ndarray_t_t_as_u_u_1d, - stdlib_ndarray_t_t_as_u_u_2d, - stdlib_ndarray_t_t_as_u_u_3d, - stdlib_ndarray_t_t_as_u_u_4d, - stdlib_ndarray_t_t_as_u_u_5d, - stdlib_ndarray_t_t_as_u_u_6d, - stdlib_ndarray_t_t_as_u_u_7d, - stdlib_ndarray_t_t_as_u_u_8d, - stdlib_ndarray_t_t_as_u_u_9d, - stdlib_ndarray_t_t_as_u_u_10d, - stdlib_ndarray_t_t_as_u_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_t_as_u_u_2d_blocked, - stdlib_ndarray_t_t_as_u_u_3d_blocked, - stdlib_ndarray_t_t_as_u_u_4d_blocked, - stdlib_ndarray_t_t_as_u_u_5d_blocked, - stdlib_ndarray_t_t_as_u_u_6d_blocked, - stdlib_ndarray_t_t_as_u_u_7d_blocked, - stdlib_ndarray_t_t_as_u_u_8d_blocked, - stdlib_ndarray_t_t_as_u_u_9d_blocked, - stdlib_ndarray_t_t_as_u_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_t_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT16; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 4, 2 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_t_as_u_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_t_as_u_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_u.c b/src/t_u.c deleted file mode 100644 index 5c55723..0000000 --- a/src/t_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_u_0d, - stdlib_ndarray_t_u_1d, - stdlib_ndarray_t_u_2d, - stdlib_ndarray_t_u_3d, - stdlib_ndarray_t_u_4d, - stdlib_ndarray_t_u_5d, - stdlib_ndarray_t_u_6d, - stdlib_ndarray_t_u_7d, - stdlib_ndarray_t_u_8d, - stdlib_ndarray_t_u_9d, - stdlib_ndarray_t_u_10d, - stdlib_ndarray_t_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_u_2d_blocked, - stdlib_ndarray_t_u_3d_blocked, - stdlib_ndarray_t_u_4d_blocked, - stdlib_ndarray_t_u_5d_blocked, - stdlib_ndarray_t_u_6d_blocked, - stdlib_ndarray_t_u_7d_blocked, - stdlib_ndarray_t_u_8d_blocked, - stdlib_ndarray_t_u_9d_blocked, - stdlib_ndarray_t_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_u_as_t_u.c b/src/t_u_as_t_u.c deleted file mode 100644 index 36b18f6..0000000 --- a/src/t_u_as_t_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint16_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_u_as_t_u_0d, - stdlib_ndarray_t_u_as_t_u_1d, - stdlib_ndarray_t_u_as_t_u_2d, - stdlib_ndarray_t_u_as_t_u_3d, - stdlib_ndarray_t_u_as_t_u_4d, - stdlib_ndarray_t_u_as_t_u_5d, - stdlib_ndarray_t_u_as_t_u_6d, - stdlib_ndarray_t_u_as_t_u_7d, - stdlib_ndarray_t_u_as_t_u_8d, - stdlib_ndarray_t_u_as_t_u_9d, - stdlib_ndarray_t_u_as_t_u_10d, - stdlib_ndarray_t_u_as_t_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_u_as_t_u_2d_blocked, - stdlib_ndarray_t_u_as_t_u_3d_blocked, - stdlib_ndarray_t_u_as_t_u_4d_blocked, - stdlib_ndarray_t_u_as_t_u_5d_blocked, - stdlib_ndarray_t_u_as_t_u_6d_blocked, - stdlib_ndarray_t_u_as_t_u_7d_blocked, - stdlib_ndarray_t_u_as_t_u_8d_blocked, - stdlib_ndarray_t_u_as_t_u_9d_blocked, - stdlib_ndarray_t_u_as_t_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_t_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_t_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_t_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_u_as_u_u.c b/src/t_u_as_u_u.c deleted file mode 100644 index 440fb9b..0000000 --- a/src/t_u_as_u_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, (uint32_t)f( (uint32_t)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint16_t, uint32_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_u_as_u_u_0d, - stdlib_ndarray_t_u_as_u_u_1d, - stdlib_ndarray_t_u_as_u_u_2d, - stdlib_ndarray_t_u_as_u_u_3d, - stdlib_ndarray_t_u_as_u_u_4d, - stdlib_ndarray_t_u_as_u_u_5d, - stdlib_ndarray_t_u_as_u_u_6d, - stdlib_ndarray_t_u_as_u_u_7d, - stdlib_ndarray_t_u_as_u_u_8d, - stdlib_ndarray_t_u_as_u_u_9d, - stdlib_ndarray_t_u_as_u_u_10d, - stdlib_ndarray_t_u_as_u_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_u_as_u_u_2d_blocked, - stdlib_ndarray_t_u_as_u_u_3d_blocked, - stdlib_ndarray_t_u_as_u_u_4d_blocked, - stdlib_ndarray_t_u_as_u_u_5d_blocked, - stdlib_ndarray_t_u_as_u_u_6d_blocked, - stdlib_ndarray_t_u_as_u_u_7d_blocked, - stdlib_ndarray_t_u_as_u_u_8d_blocked, - stdlib_ndarray_t_u_as_u_u_9d_blocked, - stdlib_ndarray_t_u_as_u_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_u_as_u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_u_as_u_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_u_as_u_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_z.c b/src/t_z.c deleted file mode 100644 index 3b1c81e..0000000 --- a/src/t_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_uint16( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint16_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_z_0d, - stdlib_ndarray_t_z_1d, - stdlib_ndarray_t_z_2d, - stdlib_ndarray_t_z_3d, - stdlib_ndarray_t_z_4d, - stdlib_ndarray_t_z_5d, - stdlib_ndarray_t_z_6d, - stdlib_ndarray_t_z_7d, - stdlib_ndarray_t_z_8d, - stdlib_ndarray_t_z_9d, - stdlib_ndarray_t_z_10d, - stdlib_ndarray_t_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_z_2d_blocked, - stdlib_ndarray_t_z_3d_blocked, - stdlib_ndarray_t_z_4d_blocked, - stdlib_ndarray_t_z_5d_blocked, - stdlib_ndarray_t_z_6d_blocked, - stdlib_ndarray_t_z_7d_blocked, - stdlib_ndarray_t_z_8d_blocked, - stdlib_ndarray_t_z_9d_blocked, - stdlib_ndarray_t_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint16_t fcn( const uint16_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_z_as_t_z.c b/src/t_z_as_t_z.c deleted file mode 100644 index eb3ff9f..0000000 --- a/src/t_z_as_t_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint16_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( uint16_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_z_as_t_z_0d, - stdlib_ndarray_t_z_as_t_z_1d, - stdlib_ndarray_t_z_as_t_z_2d, - stdlib_ndarray_t_z_as_t_z_3d, - stdlib_ndarray_t_z_as_t_z_4d, - stdlib_ndarray_t_z_as_t_z_5d, - stdlib_ndarray_t_z_as_t_z_6d, - stdlib_ndarray_t_z_as_t_z_7d, - stdlib_ndarray_t_z_as_t_z_8d, - stdlib_ndarray_t_z_as_t_z_9d, - stdlib_ndarray_t_z_as_t_z_10d, - stdlib_ndarray_t_z_as_t_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_z_as_t_z_2d_blocked, - stdlib_ndarray_t_z_as_t_z_3d_blocked, - stdlib_ndarray_t_z_as_t_z_4d_blocked, - stdlib_ndarray_t_z_as_t_z_5d_blocked, - stdlib_ndarray_t_z_as_t_z_6d_blocked, - stdlib_ndarray_t_z_as_t_z_7d_blocked, - stdlib_ndarray_t_z_as_t_z_8d_blocked, - stdlib_ndarray_t_z_as_t_z_9d_blocked, - stdlib_ndarray_t_z_as_t_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_t_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint16_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_t_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_t_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/t_z_as_z_z.c b/src/t_z_as_z_z.c deleted file mode 100644 index f16afb2..0000000 --- a/src/t_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - uint16_t v; - int8_t status = stdlib_ndarray_iget_uint16( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_uint16( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 2 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 16, 16, 16, 16, 16, 16, 8, 4, 2 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint16_t, stdlib_complex128_t, stdlib_complex128_from_uint16, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_t_z_as_z_z_0d, - stdlib_ndarray_t_z_as_z_z_1d, - stdlib_ndarray_t_z_as_z_z_2d, - stdlib_ndarray_t_z_as_z_z_3d, - stdlib_ndarray_t_z_as_z_z_4d, - stdlib_ndarray_t_z_as_z_z_5d, - stdlib_ndarray_t_z_as_z_z_6d, - stdlib_ndarray_t_z_as_z_z_7d, - stdlib_ndarray_t_z_as_z_z_8d, - stdlib_ndarray_t_z_as_z_z_9d, - stdlib_ndarray_t_z_as_z_z_10d, - stdlib_ndarray_t_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_t_z_as_z_z_2d_blocked, - stdlib_ndarray_t_z_as_z_z_3d_blocked, - stdlib_ndarray_t_z_as_z_z_4d_blocked, - stdlib_ndarray_t_z_as_z_z_5d_blocked, - stdlib_ndarray_t_z_as_z_z_6d_blocked, - stdlib_ndarray_t_z_as_z_z_7d_blocked, - stdlib_ndarray_t_z_as_z_z_8d_blocked, - stdlib_ndarray_t_z_as_z_z_9d_blocked, - stdlib_ndarray_t_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/t_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT16; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_t_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_t_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_d.c b/src/u_d.c deleted file mode 100644 index fbcd671..0000000 --- a/src/u_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint32_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_d_0d, - stdlib_ndarray_u_d_1d, - stdlib_ndarray_u_d_2d, - stdlib_ndarray_u_d_3d, - stdlib_ndarray_u_d_4d, - stdlib_ndarray_u_d_5d, - stdlib_ndarray_u_d_6d, - stdlib_ndarray_u_d_7d, - stdlib_ndarray_u_d_8d, - stdlib_ndarray_u_d_9d, - stdlib_ndarray_u_d_10d, - stdlib_ndarray_u_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_d_2d_blocked, - stdlib_ndarray_u_d_3d_blocked, - stdlib_ndarray_u_d_4d_blocked, - stdlib_ndarray_u_d_5d_blocked, - stdlib_ndarray_u_d_6d_blocked, - stdlib_ndarray_u_d_7d_blocked, - stdlib_ndarray_u_d_8d_blocked, - stdlib_ndarray_u_d_9d_blocked, - stdlib_ndarray_u_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_d_as_d_d.c b/src/u_d_as_d_d.c deleted file mode 100644 index 60c1c00..0000000 --- a/src/u_d_as_d_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, (double)f( (double)v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const double x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST( uint32_t, double, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_d_as_d_d_0d, - stdlib_ndarray_u_d_as_d_d_1d, - stdlib_ndarray_u_d_as_d_d_2d, - stdlib_ndarray_u_d_as_d_d_3d, - stdlib_ndarray_u_d_as_d_d_4d, - stdlib_ndarray_u_d_as_d_d_5d, - stdlib_ndarray_u_d_as_d_d_6d, - stdlib_ndarray_u_d_as_d_d_7d, - stdlib_ndarray_u_d_as_d_d_8d, - stdlib_ndarray_u_d_as_d_d_9d, - stdlib_ndarray_u_d_as_d_d_10d, - stdlib_ndarray_u_d_as_d_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_d_as_d_d_2d_blocked, - stdlib_ndarray_u_d_as_d_d_3d_blocked, - stdlib_ndarray_u_d_as_d_d_4d_blocked, - stdlib_ndarray_u_d_as_d_d_5d_blocked, - stdlib_ndarray_u_d_as_d_d_6d_blocked, - stdlib_ndarray_u_d_as_d_d_7d_blocked, - stdlib_ndarray_u_d_as_d_d_8d_blocked, - stdlib_ndarray_u_d_as_d_d_9d_blocked, - stdlib_ndarray_u_d_as_d_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_d_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const double x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_d_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_d_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_d_as_u_d.c b/src/u_d_as_u_d.c deleted file mode 100644 index 07d25b3..0000000 --- a/src/u_d_as_u_d.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint32_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint32_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_d_as_u_d_0d, - stdlib_ndarray_u_d_as_u_d_1d, - stdlib_ndarray_u_d_as_u_d_2d, - stdlib_ndarray_u_d_as_u_d_3d, - stdlib_ndarray_u_d_as_u_d_4d, - stdlib_ndarray_u_d_as_u_d_5d, - stdlib_ndarray_u_d_as_u_d_6d, - stdlib_ndarray_u_d_as_u_d_7d, - stdlib_ndarray_u_d_as_u_d_8d, - stdlib_ndarray_u_d_as_u_d_9d, - stdlib_ndarray_u_d_as_u_d_10d, - stdlib_ndarray_u_d_as_u_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_d_as_u_d_2d_blocked, - stdlib_ndarray_u_d_as_u_d_3d_blocked, - stdlib_ndarray_u_d_as_u_d_4d_blocked, - stdlib_ndarray_u_d_as_u_d_5d_blocked, - stdlib_ndarray_u_d_as_u_d_6d_blocked, - stdlib_ndarray_u_d_as_u_d_7d_blocked, - stdlib_ndarray_u_d_as_u_d_8d_blocked, - stdlib_ndarray_u_d_as_u_d_9d_blocked, - stdlib_ndarray_u_d_as_u_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_d_as_u_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_d_as_u_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_d_as_u_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_u.c b/src/u_u.c deleted file mode 100644 index df32654..0000000 --- a/src/u_u.c +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_u.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_uint32( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 16, 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( uint32_t, uint32_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_u_0d, - stdlib_ndarray_u_u_1d, - stdlib_ndarray_u_u_2d, - stdlib_ndarray_u_u_3d, - stdlib_ndarray_u_u_4d, - stdlib_ndarray_u_u_5d, - stdlib_ndarray_u_u_6d, - stdlib_ndarray_u_u_7d, - stdlib_ndarray_u_u_8d, - stdlib_ndarray_u_u_9d, - stdlib_ndarray_u_u_10d, - stdlib_ndarray_u_u_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_u_2d_blocked, - stdlib_ndarray_u_u_3d_blocked, - stdlib_ndarray_u_u_4d_blocked, - stdlib_ndarray_u_u_5d_blocked, - stdlib_ndarray_u_u_6d_blocked, - stdlib_ndarray_u_u_7d_blocked, - stdlib_ndarray_u_u_8d_blocked, - stdlib_ndarray_u_u_9d_blocked, - stdlib_ndarray_u_u_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_u.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_UINT32; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 8, 4 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_u( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_u( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_z.c b/src/u_z.c deleted file mode 100644 index 833d017..0000000 --- a/src/u_z.c +++ /dev/null @@ -1,2169 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_uint32( f( v ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef uint32_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_z_0d, - stdlib_ndarray_u_z_1d, - stdlib_ndarray_u_z_2d, - stdlib_ndarray_u_z_3d, - stdlib_ndarray_u_z_4d, - stdlib_ndarray_u_z_5d, - stdlib_ndarray_u_z_6d, - stdlib_ndarray_u_z_7d, - stdlib_ndarray_u_z_8d, - stdlib_ndarray_u_z_9d, - stdlib_ndarray_u_z_10d, - stdlib_ndarray_u_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_z_2d_blocked, - stdlib_ndarray_u_z_3d_blocked, - stdlib_ndarray_u_z_4d_blocked, - stdlib_ndarray_u_z_5d_blocked, - stdlib_ndarray_u_z_6d_blocked, - stdlib_ndarray_u_z_7d_blocked, - stdlib_ndarray_u_z_8d_blocked, - stdlib_ndarray_u_z_9d_blocked, - stdlib_ndarray_u_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static uint32_t fcn( const uint32_t x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_z_as_u_z.c b/src/u_z_as_u_z.c deleted file mode 100644 index a6d086f..0000000 --- a/src/u_z_as_u_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const uint32_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( uint32_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_z_as_u_z_0d, - stdlib_ndarray_u_z_as_u_z_1d, - stdlib_ndarray_u_z_as_u_z_2d, - stdlib_ndarray_u_z_as_u_z_3d, - stdlib_ndarray_u_z_as_u_z_4d, - stdlib_ndarray_u_z_as_u_z_5d, - stdlib_ndarray_u_z_as_u_z_6d, - stdlib_ndarray_u_z_as_u_z_7d, - stdlib_ndarray_u_z_as_u_z_8d, - stdlib_ndarray_u_z_as_u_z_9d, - stdlib_ndarray_u_z_as_u_z_10d, - stdlib_ndarray_u_z_as_u_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_z_as_u_z_2d_blocked, - stdlib_ndarray_u_z_as_u_z_3d_blocked, - stdlib_ndarray_u_z_as_u_z_4d_blocked, - stdlib_ndarray_u_z_as_u_z_5d_blocked, - stdlib_ndarray_u_z_as_u_z_6d_blocked, - stdlib_ndarray_u_z_as_u_z_7d_blocked, - stdlib_ndarray_u_z_as_u_z_8d_blocked, - stdlib_ndarray_u_z_as_u_z_9d_blocked, - stdlib_ndarray_u_z_as_u_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_u_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const uint32_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_u_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_u_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/u_z_as_z_z.c b/src/u_z_as_z_z.c deleted file mode 100644 index 06104ad..0000000 --- a/src/u_z_as_z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_0d( struct ndarray *arrays[], void *fcn ) { - uint32_t v; - int8_t status = stdlib_ndarray_iget_uint32( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, stdlib_complex128_from_complex128( f( stdlib_complex128_from_uint32( v ) ) ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 4 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 32, 32, 32, 32, 32, 32, 16, 8, 4 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 16, 8, 4 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_ARG_CAST_FCN( uint32_t, stdlib_complex128_t, stdlib_complex128_from_uint32, stdlib_complex128_from_complex128 ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_u_z_as_z_z_0d, - stdlib_ndarray_u_z_as_z_z_1d, - stdlib_ndarray_u_z_as_z_z_2d, - stdlib_ndarray_u_z_as_z_z_3d, - stdlib_ndarray_u_z_as_z_z_4d, - stdlib_ndarray_u_z_as_z_z_5d, - stdlib_ndarray_u_z_as_z_z_6d, - stdlib_ndarray_u_z_as_z_z_7d, - stdlib_ndarray_u_z_as_z_z_8d, - stdlib_ndarray_u_z_as_z_z_9d, - stdlib_ndarray_u_z_as_z_z_10d, - stdlib_ndarray_u_z_as_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_u_z_as_z_z_2d_blocked, - stdlib_ndarray_u_z_as_z_z_3d_blocked, - stdlib_ndarray_u_z_as_z_z_4d_blocked, - stdlib_ndarray_u_z_as_z_z_5d_blocked, - stdlib_ndarray_u_z_as_z_z_6d_blocked, - stdlib_ndarray_u_z_as_z_z_7d_blocked, - stdlib_ndarray_u_z_as_z_z_8d_blocked, - stdlib_ndarray_u_z_as_z_z_9d_blocked, - stdlib_ndarray_u_z_as_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/u_z_as_z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_UINT32; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_u_z_as_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_u_z_as_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/x_x.c b/src/x_x.c deleted file mode 100644 index 86d74a5..0000000 --- a/src/x_x.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/x_x.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0 }; -* uint8_t ybuf[] = { 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_0d( struct ndarray *arrays[], void *fcn ) { - bool v; - int8_t status = stdlib_ndarray_iget_bool( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_bool( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 1 }; -* int64_t sy[] = { 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_1d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_2d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_3d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_4d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_5d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_6d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_7d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_8d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_9d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_10d( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* int64_t sy[] = { 8, 8, 8, 8, 8, 8, 8, 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK( bool, bool ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 4, 2, 1 }; -* int64_t sy[] = { 4, 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x_nd( struct ndarray *arrays[], void *fcn ) { - typedef bool func_type( const bool x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK( bool, bool ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_x_x_0d, - stdlib_ndarray_x_x_1d, - stdlib_ndarray_x_x_2d, - stdlib_ndarray_x_x_3d, - stdlib_ndarray_x_x_4d, - stdlib_ndarray_x_x_5d, - stdlib_ndarray_x_x_6d, - stdlib_ndarray_x_x_7d, - stdlib_ndarray_x_x_8d, - stdlib_ndarray_x_x_9d, - stdlib_ndarray_x_x_10d, - stdlib_ndarray_x_x_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_x_x_2d_blocked, - stdlib_ndarray_x_x_3d_blocked, - stdlib_ndarray_x_x_4d_blocked, - stdlib_ndarray_x_x_5d_blocked, - stdlib_ndarray_x_x_6d_blocked, - stdlib_ndarray_x_x_7d_blocked, - stdlib_ndarray_x_x_8d_blocked, - stdlib_ndarray_x_x_9d_blocked, - stdlib_ndarray_x_x_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/x_x.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_BOOL; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_BOOL; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 2, 1 }; -* int64_t sy[] = { 2, 1 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static bool fcn( const bool x ) { -* return x; -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_x_x( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_x_x( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/z_d_as_z_d.c b/src/z_d_as_z_d.c deleted file mode 100644 index ce684c2..0000000 --- a/src/z_d_as_z_d.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex128_t v; - int8_t status = stdlib_ndarray_iget_complex128( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_float64( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 16 }; -* int64_t sy[] = { 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_1d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_2d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_3d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_4d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_5d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_6d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_7d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_8d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_9d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_10d( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 64, 64, 64, 64, 64, 64, 64, 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16 }; -* int64_t sy[] = { 32, 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d_nd( struct ndarray *arrays[], void *fcn ) { - typedef double func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, double ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_z_d_as_z_d_0d, - stdlib_ndarray_z_d_as_z_d_1d, - stdlib_ndarray_z_d_as_z_d_2d, - stdlib_ndarray_z_d_as_z_d_3d, - stdlib_ndarray_z_d_as_z_d_4d, - stdlib_ndarray_z_d_as_z_d_5d, - stdlib_ndarray_z_d_as_z_d_6d, - stdlib_ndarray_z_d_as_z_d_7d, - stdlib_ndarray_z_d_as_z_d_8d, - stdlib_ndarray_z_d_as_z_d_9d, - stdlib_ndarray_z_d_as_z_d_10d, - stdlib_ndarray_z_d_as_z_d_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_z_d_as_z_d_2d_blocked, - stdlib_ndarray_z_d_as_z_d_3d_blocked, - stdlib_ndarray_z_d_as_z_d_4d_blocked, - stdlib_ndarray_z_d_as_z_d_5d_blocked, - stdlib_ndarray_z_d_as_z_d_6d_blocked, - stdlib_ndarray_z_d_as_z_d_7d_blocked, - stdlib_ndarray_z_d_as_z_d_8d_blocked, - stdlib_ndarray_z_d_as_z_d_9d_blocked, - stdlib_ndarray_z_d_as_z_d_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_d_as_z_d.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_FLOAT64; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16 }; -* int64_t sy[] = { 16, 8 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static double fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_d_as_z_d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_d_as_z_d( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/src/z_z.c b/src/z_z.c deleted file mode 100644 index df94b99..0000000 --- a/src/z_z.c +++ /dev/null @@ -1,2191 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* -* The following is auto-generated. Do not manually edit. See scripts/loops.js. -*/ - -#include "stdlib/ndarray/base/unary/z_z.h" -#include "stdlib/ndarray/base/unary/typedefs.h" -#include "stdlib/ndarray/base/unary/macros.h" -#include "stdlib/ndarray/base/unary/dispatch_object.h" -#include "stdlib/ndarray/base/unary/dispatch.h" -#include "stdlib/ndarray/ctor.h" -#include "stdlib/complex/float64/ctor.h" -#include - -/** -* Applies a unary callback to a zero-dimensional input ndarray and assigns results to elements in a zero-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 0; -* -* // Define the array shapes: -* int64_t shape[] = {}; -* -* // Define the strides: -* int64_t sx[] = { 0 }; -* int64_t sy[] = { 0 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_0d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_0d( struct ndarray *arrays[], void *fcn ) { - stdlib_complex128_t v; - int8_t status = stdlib_ndarray_iget_complex128( arrays[ 0 ], 0, &v ); - if ( status != 0 ) { - return -1; - } - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - status = stdlib_ndarray_iset_complex128( arrays[ 1 ], 0, f( v ) ); - if ( status != 0 ) { - return -1; - } - return 0; -} - -/** -* Applies a unary callback to a one-dimensional input ndarray and assigns results to elements in a one-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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 }; -* uint8_t ybuf[] = { 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 1; -* -* // Define the array shapes: -* int64_t shape[] = { 3 }; -* -* // Define the strides: -* int64_t sx[] = { 16 }; -* int64_t sy[] = { 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_1d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_1d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_1D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_2d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_2d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a two-dimensional input ndarray and assigns results to elements in a two-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_2d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_2d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_2D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_3d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_3d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a three-dimensional input ndarray and assigns results to elements in a three-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_3d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_3d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_3D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_4d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_4d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a four-dimensional input ndarray and assigns results to elements in a four-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 4; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_4d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_4d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_4D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_5d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_5d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a five-dimensional input ndarray and assigns results to elements in a five-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 5; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_5d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_5d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_5D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_6d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_6d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a six-dimensional input ndarray and assigns results to elements in a six-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 6; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_6d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_6d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_6D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_7d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_7d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a seven-dimensional input ndarray and assigns results to elements in a seven-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 7; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_7d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_7d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_7D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_8d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_8d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an eight-dimensional input ndarray and assigns results to elements in an eight-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 8; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_8d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_8d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_8D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_9d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_9d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a nine-dimensional input ndarray and assigns results to elements in a nine-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 9; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_9d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_9d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_9D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_10d( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_10d( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to a ten-dimensional input ndarray and assigns results to elements in a ten-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 10; -* -* // Define the array shapes: -* int64_t shape[] = { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* int64_t sy[] = { 128, 128, 128, 128, 128, 128, 128, 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_10d_blocked( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_10d_blocked( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_10D_BLOCKED_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -/** -* Applies a unary callback to an n-dimensional input ndarray and assigns results to elements in an n-dimensional output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 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, 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 }; -* uint8_t ybuf[] = { 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, 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, 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 }; -* -* // Define the number of dimensions: -* int64_t ndims = 3; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 64, 32, 16 }; -* int64_t sy[] = { 64, 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z_nd( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z_nd( struct ndarray *arrays[], void *fcn ) { - typedef stdlib_complex128_t func_type( const stdlib_complex128_t x ); - func_type *f = (func_type *)fcn; - STDLIB_NDARRAY_UNARY_ND_LOOP_CLBK_RET_NOCAST( stdlib_complex128_t, stdlib_complex128_t ) - return 0; -} - -// Define a list of unary ndarray functions: -static ndarrayUnaryFcn functions[] = { - stdlib_ndarray_z_z_0d, - stdlib_ndarray_z_z_1d, - stdlib_ndarray_z_z_2d, - stdlib_ndarray_z_z_3d, - stdlib_ndarray_z_z_4d, - stdlib_ndarray_z_z_5d, - stdlib_ndarray_z_z_6d, - stdlib_ndarray_z_z_7d, - stdlib_ndarray_z_z_8d, - stdlib_ndarray_z_z_9d, - stdlib_ndarray_z_z_10d, - stdlib_ndarray_z_z_nd -}; - -// Define a list of unary ndarray functions implementing loop blocking... -static ndarrayUnaryFcn blocked_functions[] = { - stdlib_ndarray_z_z_2d_blocked, - stdlib_ndarray_z_z_3d_blocked, - stdlib_ndarray_z_z_4d_blocked, - stdlib_ndarray_z_z_5d_blocked, - stdlib_ndarray_z_z_6d_blocked, - stdlib_ndarray_z_z_7d_blocked, - stdlib_ndarray_z_z_8d_blocked, - stdlib_ndarray_z_z_9d_blocked, - stdlib_ndarray_z_z_10d_blocked -}; - -// Create a unary function dispatch object: -static const struct ndarrayUnaryDispatchObject obj = { - // Array containing unary ndarray functions: - functions, - - // Number of unary ndarray functions: - 12, - - // Array containing unary ndarray functions using loop blocking: - blocked_functions, - - // Number of unary ndarray functions using loop blocking: - 9 -}; - -/** -* Applies a unary callback to an input ndarray and assigns results to elements in an output ndarray. -* -* ## Notes -* -* - If successful, the functions returns `0`; otherwise, the function returns an error code. -* -* @param arrays array whose first element is a pointer to an input ndarray and whose last element is a pointer to an output ndarray -* @param fcn callback -* @return status code -* -* @example -* #include "stdlib/ndarray/base/unary/z_z.h" -* #include "stdlib/ndarray/dtypes.h" -* #include "stdlib/ndarray/index_modes.h" -* #include "stdlib/ndarray/orders.h" -* #include "stdlib/ndarray/ctor.h" -* #include "stdlib/complex/float64/ctor.h" -* #include -* #include -* #include -* -* // Define the ndarray data types: -* enum STDLIB_NDARRAY_DTYPE xdtype = STDLIB_NDARRAY_COMPLEX128; -* enum STDLIB_NDARRAY_DTYPE ydtype = STDLIB_NDARRAY_COMPLEX128; -* -* // Create underlying byte arrays: -* uint8_t xbuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* uint8_t ybuf[] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -* -* // Define the number of dimensions: -* int64_t ndims = 2; -* -* // Define the array shapes: -* int64_t shape[] = { 2, 2 }; -* -* // Define the strides: -* int64_t sx[] = { 32, 16 }; -* int64_t sy[] = { 32, 16 }; -* -* // Define the offsets: -* int64_t ox = 0; -* int64_t oy = 0; -* -* // Define the array order: -* 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[] = { imode }; -* int64_t nsubmodes = 1; -* -* // Create an input ndarray: -* struct ndarray *x = stdlib_ndarray_allocate( xdtype, xbuf, ndims, shape, sx, ox, order, imode, nsubmodes, submodes ); -* if ( x == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an output ndarray: -* struct ndarray *y = stdlib_ndarray_allocate( ydtype, ybuf, ndims, shape, sy, oy, order, imode, nsubmodes, submodes ); -* if ( y == NULL ) { -* fprintf( stderr, "Error allocating memory.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // Create an array containing the ndarrays: -* struct ndarray *arrays[] = { x, y }; -* -* // Define a callback: -* static stdlib_complex128_t fcn( const stdlib_complex128_t x ) { -* // ... -* } -* -* // Apply the callback: -* int8_t status = stdlib_ndarray_z_z( arrays, (void *)fcn ); -* if ( status != 0 ) { -* fprintf( stderr, "Error during computation.\n" ); -* exit( EXIT_FAILURE ); -* } -* -* // ... -* -* // Free allocated memory: -* stdlib_ndarray_free( x ); -* stdlib_ndarray_free( y ); -*/ -int8_t stdlib_ndarray_z_z( struct ndarray *arrays[], void *fcn ) { - return stdlib_ndarray_unary_dispatch( &obj, arrays, fcn ); -} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..108e9c7 --- /dev/null +++ b/stats.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index a8a9c60..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var main = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is defined', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( main !== void 0, true, 'main export is defined' ); - t.end(); -}); diff --git a/test/test.0d.js b/test/test.0d.js deleted file mode 100644 index 31fbb8e..0000000 --- a/test/test.0d.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function'); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 0-dimensional ndarray', function test( t ) { - var expected; - var x; - var y; - - x = scalar2ndarray( 5.0, { - 'dtype': 'float64' - }); - - y = scalar2ndarray( 0.0, { - 'dtype': 'float64' - }); - - unary( [ x, y ], scale ); - - expected = new Float64Array( [ 50.0 ] ); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 0-dimensional ndarray (accessors)', function test( t ) { - var expected; - var x; - var y; - - x = scalar2ndarray( new Complex128( 5.0, 5.0 ), { - 'dtype': 'complex128' - }); - - y = scalar2ndarray( new Complex128( 0.0, 0.0 ), { - 'dtype': 'complex128' - }); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( [ 50.0, 50.0 ] ); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.10d.js b/test/test.10d.js deleted file mode 100644 index d4482af..0000000 --- a/test/test.10d.js +++ /dev/null @@ -1,2606 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ 32, 16, 16, -16, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, 32, 16, -16, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, bsize*32, 16, -8, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, bsize*64, bsize*32, -16, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; - st = [ bsize*32, bsize*32, bsize*32, -bsize*16, 8, 4, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ bsize*32, bsize*32, bsize*32, -bsize*32, bsize*16, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ - bsize*64, - bsize*64, - bsize*32, - -bsize*32, - bsize*32, - bsize*16, - -8, - 4, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2, 2 ]; - st = [ - bsize*64, - bsize*64, - bsize*32, - -bsize*32, - bsize*32, - bsize*32, - -bsize*16, - 8, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; - st = [ - bsize*64, - bsize*64, - bsize*32, - -bsize*32, - bsize*16, - bsize*16, - -bsize*16, - bsize*8, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; - st = [ - bsize*32, - bsize*32, - bsize*16, - -bsize*16, - bsize*8, - bsize*8, - -bsize*8, - bsize*8, - bsize*4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 9 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ 32, 16, 16, -16, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, 32, 16, -16, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, bsize*32, 16, -8, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, bsize*64, bsize*32, -16, 8, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; - st = [ bsize*32, bsize*32, bsize*32, -bsize*16, 8, 4, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ bsize*32, bsize*32, bsize*32, -bsize*32, bsize*16, 8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ - bsize*64, - bsize*64, - bsize*32, - -bsize*32, - bsize*32, - bsize*16, - -8, - 4, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2, 2 ]; - st = [ - bsize*64, - bsize*64, - bsize*32, - -bsize*32, - bsize*32, - bsize*32, - -bsize*16, - 8, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; - st = [ - bsize*64, - bsize*64, - bsize*32, - -bsize*32, - bsize*16, - bsize*16, - -bsize*16, - bsize*8, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; - st = [ - bsize*32, - bsize*32, - bsize*16, - -bsize*16, - bsize*8, - bsize*8, - -bsize*8, - bsize*8, - bsize*4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 9 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2, 1, 1 ]; - st = [ -1, -1, -1, -1, -1, -2, -4, -4, -8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset(sh, st); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ - 2, - bsize*4, - bsize*8, - -bsize*8, - bsize*8, - bsize*16, - bsize*16, - -bsize*32, - bsize*32, - bsize*32 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ - 2, - 4, - bsize*8, - bsize*16, - bsize*16, - bsize*32, - bsize*32, - bsize*64, - bsize*64, - bsize*64 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ - 2, - 4, - 8, - bsize*16, - bsize*32, - bsize*32, - bsize*32, - bsize*64, - bsize*64, - bsize*64 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; - st = [ - 2, - 4, - 4, - 8, - bsize*16, - bsize*32, - bsize*32, - bsize*64, - bsize*64, - bsize*64 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; - st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ 2, 4, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 2, bsize*2, 2, 1 ]; - st = [ 2, 4, 4, 8, 8, 16, 16, 32, bsize*64, bsize*128 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 16, 16, 16, 32, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 16, -16, 16, 16, 32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = [ -1, -1, -1, -1, -1, -1, -2, -4, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -1, -1, -1, 1, -1, 1, 1, -4, -8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 1, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ - 2, - bsize*4, - bsize*8, - -bsize*8, - bsize*8, - bsize*16, - bsize*16, - -bsize*32, - bsize*32, - bsize*32 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 2, 1, 2, 1, 1, 2 ]; - st = [ - 2, - 4, - bsize*8, - bsize*16, - bsize*16, - bsize*32, - bsize*32, - bsize*64, - bsize*64, - bsize*64 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ - 2, - 4, - 8, - bsize*16, - bsize*32, - bsize*32, - bsize*32, - bsize*64, - bsize*64, - bsize*64 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; - st = [ - 2, - 4, - 4, - 8, - bsize*16, - bsize*32, - bsize*32, - bsize*64, - bsize*64, - bsize*64 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; - st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ 2, 4, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 2, bsize*2, 2, 1 ]; - st = [ 2, 4, 4, 8, 8, 16, 16, 32, bsize*64, bsize*128 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 16, 16, 16, 32, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 10-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 1, 2, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 16, -16, 16, 16, 32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.1d.js b/test/test.1d.js deleted file mode 100644 index b06fc93..0000000 --- a/test/test.1d.js +++ /dev/null @@ -1,118 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function'); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 1-dimensional ndarray', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ), [ 4 ], [ 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 4 ], [ 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 1-dimensional ndarray (empty array)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ), [ 0 ], [ 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0 ], [ 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 1-dimensional ndarray (accessors)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'complex128', new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] ), [ 4 ], [ 1 ], 0, 'row-major' ); - y = ndarray( 'complex128', zeros( 4, 'complex128' ), [ 4 ], [ 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.2d.js b/test/test.2d.js deleted file mode 100644 index e7a4010..0000000 --- a/test/test.2d.js +++ /dev/null @@ -1,1175 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function'); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 0 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = [ -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = [ 4, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = [ 4, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2 ]; - st = [ -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 1 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2 ]; - st = [ bsize*4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 1 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = [ -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = [ 4, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 2 ]; - st = [ 4, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2 ]; - st = [ -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 1 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2 ]; - st = [ bsize*4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 1 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0 ], [ 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0 ], [ 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = [ -1, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = [ 1, 4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = [ 1, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2 ]; - st = [ 2, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2 ]; - st = [ -2, 4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = [ -1, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = [ 1, 4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 2 ]; - st = [ 1, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2 ]; - st = [ 2, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 2-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2 ]; - st = [ -2, 4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.3d.js b/test/test.3d.js deleted file mode 100644 index c69fa44..0000000 --- a/test/test.3d.js +++ /dev/null @@ -1,1306 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var ones = require( '@stdlib/array-ones' ); -var oneTo = require( '@stdlib/array-one-to' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0 ], [ 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0 ], [ 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2, 2 ]; - st = [ -4, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2 ]; - st = [ 3, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 6, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 40.0, - 50.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2 ]; - st = [ -3, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 6, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 40.0, - 50.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2 ]; - st = [ -4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 2 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, bsize*2, 2 ]; - st = [ -bsize*8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 2 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, bsize*2 ]; - st = [ bsize*8, bsize*4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 2 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 2, 2 ]; - st = [ -4, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2 ]; - st = [ 3, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 70.0, - 80.0, - 90.0, - 100.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2 ]; - st = [ -3, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 70.0, - 80.0, - 90.0, - 100.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2 ]; - st = [ -4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 2 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, bsize*2, 2 ]; - st = [ -bsize*8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 2 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (row-major, non-contiguous, large arrays, accessors', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, bsize*2 ]; - st = [ bsize*8, bsize*4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 2 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0 ], [ 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0 ], [ 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2, 2 ]; - st = [ -1, -2, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2 ]; - st = [ 1, 2, 3 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 6, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 40.0, - 50.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2 ]; - st = [ -1, -2, 3 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 6, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 40.0, - 50.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2 ]; - st = [ 2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1 ]; - st = [ 2, -4, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 1 ]; - st = [ -2, bsize*4, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 2, 2 ]; - st = [ -1, -2, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2 ]; - st = [ 1, 2, 3 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 70.0, - 80.0, - 90.0, - 100.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2 ]; - st = [ -1, -2, 3 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 6, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 70.0, - 80.0, - 90.0, - 100.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2 ]; - st = [ 2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1 ]; - st = [ 2, -4, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a nullary callback to each indexed element of a 3-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2 ]; - st = [ 2, -4, 4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.4d.js b/test/test.4d.js deleted file mode 100644 index fb9106c..0000000 --- a/test/test.4d.js +++ /dev/null @@ -1,1470 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0 ], [ 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0 ], [ 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2, 1, 2 ]; - st = [ -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 4, 2, 1, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 4, -2, -1, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1 ]; - st = [ -4, -4, 2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 3 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, bsize*2, 2, 1 ]; - st = [ -bsize*8, -4, 2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 3 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, bsize*2, 1 ]; - st = [ bsize*8, bsize*4, -2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 3 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, 1, bsize*2 ]; - st = [ bsize*8, bsize*4, bsize*4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 3 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 2, 1, 2 ]; - st = [ -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 4, 2, 1, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 4, -2, -1, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1 ]; - st = [ -4, -4, 2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 3 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, bsize*2, 2, 1 ]; - st = [ -bsize*8, -4, 2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 3 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, bsize*2, 1 ]; - st = [ bsize*8, bsize*4, -2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 3 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, 1, bsize*2 ]; - st = [ bsize*8, bsize*4, bsize*4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 3 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0 ], [ 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0 ], [ 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2, 1, 2 ]; - st = [ -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 1, 2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 1, -2, -4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 8, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, 1, bsize*2 ]; - st = [ 2, 2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, bsize*2, 1 ]; - st = [ 2, 2, -4, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 1, bsize*2, 1, 2 ]; - st = [ 2, 2, -bsize*4, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 1, 2 ]; - st = [ 2, -bsize*4, bsize*4, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 2, 1, 2 ]; - st = [ -1, -2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 1, 2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1 ]; - st = [ 1, 2, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 8, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1 ]; - st = [ 2, -bsize*4, -bsize*4, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1 ]; - st = [ 1, 2, -bsize*4, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1 ]; - st = [ 2, 4, -4, -bsize*4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 4-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*4 ]; - st = [ 2, 4, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.5d.js b/test/test.5d.js deleted file mode 100644 index 129f8cc..0000000 --- a/test/test.5d.js +++ /dev/null @@ -1,1697 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 2, 1, 2, 2 ]; - st = [ -8, -4, -4, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 8, 4, 2, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 12, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 8, 4, -2, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 12, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2 ]; - st = [ 8, -8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 4 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 2 ]; - st = [ bsize*8, -4, 4, -4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 4 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2 ]; - st = [ bsize*8, bsize*8, -4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 4 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 1 ]; - st = [ bsize*8, -bsize*8, -bsize*4, -2, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 4 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2 ]; - st = [ bsize*8, -bsize*8, -bsize*4, -bsize*4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 4 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( x ) { - return x * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ -4, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 8, 4, 2, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 8, 4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2 ]; - st = [ 8, -8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 4 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 2 ]; - st = [ bsize*8, -4, 4, -4, -2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 4 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2 ]; - st = [ bsize*8, bsize*8, -4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 4 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 2 ]; - st = [ bsize*8, -bsize*8, -bsize*8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 4 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2 ]; - st = [ bsize*8, -bsize*8, -bsize*4, -bsize*4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 4 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 4 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', ones( 4, 'float64' ), [ 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 2, 1, 2, 2 ]; - st = [ -1, -2, -4, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 1, 2, 2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 12, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 1, 2, -2, -4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 12, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2 ]; - st = [ -2, bsize*4, -bsize*4, bsize*8, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 2 ]; - st = [ -2, 4, -bsize*8, bsize*8, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2 ]; - st = [ -2, 4, -4, bsize*8, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 2 ]; - st = [ -2, 4, -4, 4, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2 ]; - st = [ -2, 4, -4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ -1, -2, -2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 1, 2, 2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2 ]; - st = [ 1, 2, -2, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2 ]; - st = [ -2, bsize*4, -bsize*4, bsize*8, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1 ]; - st = [ -2, 4, -bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2 ]; - st = [ -2, 4, -4, bsize*8, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 2 ]; - st = [ -2, -4, -4, 4, bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 5-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2 ]; - st = [ 2, 4, -4, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.6d.js b/test/test.6d.js deleted file mode 100644 index 18c3f28..0000000 --- a/test/test.6d.js +++ /dev/null @@ -1,1861 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', ones( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 8, 4, 4, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 16, -16, 8, -4, 4, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2 ]; - st = [ 8, -8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 5 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2 ]; - st = [ bsize*8, -4, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 5 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2 ]; - st = [ bsize*8, -bsize*8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 5 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2 ]; - st = [ bsize*8, -bsize*8, -bsize*8, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 5 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 1, bsize*2, 2 ]; - st = [ bsize*8, -bsize*8, -bsize*8, bsize*8, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 5 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2 ]; - st = [ bsize*8, -bsize*8, -bsize*4, bsize*4, bsize*4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh )*2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 5 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 8, 4, 4, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 8, -4, -4, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2 ]; - st = [ 8, -8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 5 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2 ]; - st = [ bsize*8, -4, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 5 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2 ]; - st = [ bsize*8, -bsize*8, -4, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 5 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2 ]; - st = [ bsize*8, -bsize*8, -bsize*8, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 5 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 1, bsize*2, 2 ]; - st = [ bsize*8, -bsize*8, -bsize*8, bsize*8, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 5 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2 ]; - st = [ bsize*8, -bsize*8, -bsize*4, bsize*4, bsize*4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 5 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', ones( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ -1, -1, -1, -2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 12, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 1, -1, 1, -2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 12, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 12, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 1, 2, 1, 2 ]; - st = [ 2, bsize*4, bsize*4, -bsize*4, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2 ]; - st = [ 2, 4, bsize*8, -bsize*8, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2 ]; - st = [ 2, 4, 4, -bsize*8, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2 ]; - st = [ 2, 4, 4, -4, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 1 ]; - st = [ 2, 4, 4, -4, 8, -bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2 ]; - st = [ 2, 4, 4, -8, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z*10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, contiguous, negative strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ -1, -1, -1, -2, -4, -4 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 2, 4, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, -2, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2 ]; - st = [ 2, bsize*4, bsize*4, -bsize*8, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2 ]; - st = [ 2, 4, bsize*8, -bsize*8, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2 ]; - st = [ 2, 4, 4, -bsize*8, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2 ]; - st = [ 2, 4, 4, -4, bsize*8, -bsize*8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 1 ]; - st = [ 2, 4, 4, -4, 8, -bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 6-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2 ]; - st = [ 2, 4, 4, -8, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.7d.js b/test/test.7d.js deleted file mode 100644 index ea11cf6..0000000 --- a/test/test.7d.js +++ /dev/null @@ -1,2050 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z) * 10.0, imag(z) * 10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -16, 16, -16, 8, -4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; - st = [ 16, -16, 8, 8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 2, 1, 1, 2 ]; - st = [ bsize*16, -8, 8, 4, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ bsize*16, -bsize*16, 8, 8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 1, 1, 2 ]; - st = [ bsize*16, -bsize*16, bsize*8, 4, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; - st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 2 ]; - st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*8, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; - st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*4, bsize*4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 6 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 2, 1, 2, 1, 2, 1, 2 ]; - st = [ -8, -8, -4, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0, - 250.0, - 260.0, - 270.0, - 280.0, - 290.0, - 300.0, - 310.0, - 320.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -16, 16, -16, -8, 4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; - st = [ 16, -16, 8, 8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ bsize*16, -8, 8, 8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ bsize*16, -bsize*16, 8, 8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 1, 1, 2 ]; - st = [ bsize*16, -bsize*16, bsize*8, 4, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; - st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, 1, bsize*2, 2 ]; - st = [ bsize*16, -bsize*16, bsize*16, bsize*8, -bsize*8, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; - st = [ bsize*16, -bsize*16, bsize*8, bsize*8, -bsize*4, bsize*4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 6 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2, 1, 2 ]; - st = [ -1, -2, -2, -4, -4, -8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 2, 4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 0.0, - 30.0, - 0.0, - 50.0, - 0.0, - 70.0, - 0.0, - 90.0, - 0.0, - 110.0, - 0.0, - 130.0, - 0.0, - 150.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, -1, 2, -4, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 0.0, - 30.0, - 0.0, - 50.0, - 0.0, - 70.0, - 0.0, - 90.0, - 0.0, - 110.0, - 0.0, - 130.0, - 0.0, - 150.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; - st = [ 2, -bsize*4, bsize*4, bsize*8, -bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 2, 1, 2, 1 ]; - st = [ 2, -4, bsize*8, bsize*8, -bsize*16, bsize*16, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ 2, -4, -4, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 2, 1, 2 ]; - st = [ 2, -4, -4, 4, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; - st = [ 2, -4, -4, 8, 8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 2 ]; - st = [ 2, -4, -4, 8, 8, 8, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; - st = [ 2, -4, -4, 8, 8, 16, 16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 2, 1, 2, 1, 2, 1, 2 ]; - st = [ -1, -2, -2, -4, -4, -8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0, - 170.0, - 180.0, - 190.0, - 200.0, - 210.0, - 220.0, - 230.0, - 240.0, - 250.0, - 260.0, - 270.0, - 280.0, - 290.0, - 300.0, - 310.0, - 320.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 2, 4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0, - 170.0, - 180.0, - 0.0, - 0.0, - 210.0, - 220.0, - 0.0, - 0.0, - 250.0, - 260.0, - 0.0, - 0.0, - 290.0, - 300.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -1, 1, -1, -2, 4, -8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0, - 170.0, - 180.0, - 0.0, - 0.0, - 210.0, - 220.0, - 0.0, - 0.0, - 250.0, - 260.0, - 0.0, - 0.0, - 290.0, - 300.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 2, 1, 2 ]; - st = [ 2, -bsize*4, -bsize*4, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ 2, -4, -bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ 2, -4, -4, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2, 2 ]; - st = [ 2, -4, -4, 4, bsize*8, bsize*8, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 2 ]; - st = [ 2, -4, -4, 8, 8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 2 ]; - st = [ 2, -4, -4, 8, 8, 8, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 7-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, bsize*2 ]; - st = [ 2, -4, -4, 8, 8, 16, 16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.8d.js b/test/test.8d.js deleted file mode 100644 index faa6eb6..0000000 --- a/test/test.8d.js +++ /dev/null @@ -1,2168 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 2 ]; - st = [ 32, -16, 8, -8, -8, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 2 ]; - st = [ -bsize*32, -16, 8, -8, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 2, 1, 2, 1, 2 ]; - st = [ -bsize*32, -bsize*32, 16, -8, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 2, 2, 1, 2 ]; - st = [ -bsize*32, -bsize*32, bsize*32, -16, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 2, 1, 2 ]; - st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 2, 2 ]; - st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -bsize*16, 8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; - st = [ - -bsize*16, - -bsize*16, - bsize*8, - -bsize*8, - -bsize*8, - bsize*4, - -bsize*4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 7 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, -16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 2 ]; - st = [ 32, 16, 8, -8, -8, 4, 4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 2 ]; - st = [ -bsize*32, -16, 8, -8, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 2, 1, 2, 1, 2 ]; - st = [ -bsize*32, -bsize*32, 16, -8, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 2, 2, 1, 2 ]; - st = [ -bsize*32, -bsize*32, bsize*32, -16, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 2, 1, 2 ]; - st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 2, 2 ]; - st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -bsize*16, 8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*8, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; - st = [ - -bsize*16, - -bsize*16, - bsize*8, - -bsize*8, - -bsize*8, - bsize*4, - -bsize*4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = [ -1, -1, -1, -1, -2, -4, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset(sh, st); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, -1, -4, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; - st = [ 2, bsize*4, bsize*4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; - st = [ 2, -4, bsize*8, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ 2, 4, 8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 1, 2, 1, 2 ]; - st = [ 2, 4, 4, 8, bsize*16, bsize*16, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 2, bsize*2, 1, 1, 2 ]; - st = [ 2, 4, 4, 8, 16, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, bsize*2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, 2, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, 32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = [ -1, -1, -1, -1, -2, -4, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -1, 1, -1, 1, 1, -4, -8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; - st = [ 2, bsize*4, bsize*4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; - st = [ 2, -4, bsize*8, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ 2, 4, 8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 1, 2, 1, 2 ]; - st = [ 2, 4, 4, 8, bsize*16, bsize*16, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 2, bsize*2, 1, 1, 2 ]; - st = [ 2, 4, 4, 8, 16, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, bsize*2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, 2, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, 32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.9d.js b/test/test.9d.js deleted file mode 100644 index c6519d7..0000000 --- a/test/test.9d.js +++ /dev/null @@ -1,2390 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var ones = require( '@stdlib/array-ones' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var dfill = require( '@stdlib/blas-ext-base-dfill' ); -var zfill = require( '@stdlib/blas-ext-base-zfill' ); -var blockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ 32, -16, -8, 8, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ bsize*32, -16, -8, 8, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 1, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, -bsize*32, -16, 8, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 2, 1, 1, 2 ]; - st = [ bsize*64, -bsize*64, -bsize*32, 16, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ bsize*64, -bsize*64, -bsize*32, bsize*16, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ bsize*64, -bsize*64, -bsize*32, bsize*32, bsize*16, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; - st = [ - bsize*64, - -bsize*64, - -bsize*32, - bsize*32, - bsize*32, - -bsize*16, - 8, - -4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; - st = [ - -bsize*32, - -bsize*32, - -bsize*16, - bsize*16, - bsize*16, - -bsize*16, - bsize*8, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2 ]; - st = [ - -bsize*32, - -bsize*32, - -bsize*16, - bsize*16, - bsize*8, - -bsize*8, - bsize*8, - bsize*4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 8 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -8, -8, -8, -8, -8, -4, -2, -2, -1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ 32, -16, -8, 8, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ bsize*32, -16, -8, 8, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 2, 1, 1, 2 ]; - st = [ bsize*64, -bsize*32, -16, 8, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 2, 1, 1, 2 ]; - st = [ bsize*64, -bsize*64, -bsize*32, 16, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ bsize*64, -bsize*64, -bsize*32, bsize*16, 8, -4, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ bsize*64, -bsize*64, -bsize*32, bsize*32, bsize*16, -8, 4, -4, 2 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; - st = [ - bsize*64, - -bsize*64, - -bsize*32, - bsize*32, - bsize*32, - -bsize*16, - 8, - -4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; - st = [ - -bsize*32, - -bsize*32, - -bsize*16, - bsize*16, - bsize*16, - -bsize*16, - bsize*8, - 4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, 1, 1, 2, bsize*2 ]; - st = [ - -bsize*32, - -bsize*32, - -bsize*16, - bsize*16, - bsize*8, - -bsize*8, - bsize*8, - bsize*4, - 2 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 8 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, empty)', function test( t ) { - var expected; - var x; - var y; - - x = ndarray( 'float64', oneTo( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - y = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1, 1 ]; - st = [ -1, -1, -1, -1, -2, -4, -4, -8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset(sh, st); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ - 2, - bsize*4, - bsize*8, - bsize*16, - bsize*16, - bsize*16, - bsize*32, - bsize*32, - bsize*32 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1, 1, 1, 1, 2 ]; - st = [ - 2, - 4, - bsize*8, - bsize*16, - bsize*16, - bsize*16, - bsize*16, - bsize*16, - bsize*16 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 1, 1, 1, 2 ]; - st = [ 2, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32, bsize*32 ]; // eslint-disable-line max-len - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; - st = [ 2, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 8, 16, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, 2, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 8, 8, 16, 32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, ones( numel( sh ) * 2, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array( x.length*2 ); - dfill( x.length, 10.0, expected, st[ 0 ] ); - - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, contiguous, accessors, negative strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = [ -1, -1, -1, -1, -1, -2, -4, -4, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -1, -1, 1, -1, 1, 1, -4, -8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 1, 2 ]; - st = [ - 2, - bsize*4, - bsize*8, - bsize*16, - bsize*16, - bsize*16, - bsize*32, - bsize*32, - bsize*32 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, bsize*2, 2, 1, 1, 1, 1, 1, 2 ]; - st = [ - 2, - 4, - bsize*8, - bsize*16, - bsize*16, - bsize*16, - bsize*16, - bsize*16, - bsize*16 - ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 2, bsize*2, 2, 1, 1, 1, 1, 2 ]; - st = [ 2, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32, bsize*32 ]; // eslint-disable-line max-len - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, bsize*2, 2, 1, 1, 1, 2 ]; - st = [ 2, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 1, 2, bsize*2, 2, 1, 1, 2 ]; - st = [ 2, 4, 4, 4, 8, bsize*16, bsize*32, bsize*32, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 2, bsize*2, 2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*64, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32, bsize*64 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 8, 16, bsize*32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of a 9-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { - var expected; - var bsize; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - - bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, 2, 2, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 8, 8, 16, 32 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( ones( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ) * 2, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array( x.length*2 ); - zfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); - - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 54ff13e..0000000 --- a/test/test.js +++ /dev/null @@ -1,137 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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( '@stdlib/ndarray-ctor' ); -var zeros = require( '@stdlib/array-zeros' ); -var ones = require( '@stdlib/array-ones' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided input and output ndarrays which do not have the same number of dimensions', function test( t ) { - var shapes; - var i; - - shapes = [ - [ [ 4, 2, 1 ], [ 4, 2 ] ], - [ [ 2, 2 ], [ 2, 2, 2 ] ], - [ [ 1, 1, 1, 1 ], [ 1, 1, 1 ] ], - [ [ 2, 2, 1, 2 ], [ 2, 1, 2 ] ], - [ [ 1, 1, 4, 2, 2, 2 ], [ 10, 2 ] ], - [ [ 1, 1, 1, 1 ], [ 1, 1, 1 ] ] - ]; - - for ( i = 0; i < shapes.length; i++ ) { - t.throws( badValue( shapes[i][0], shapes[i][1] ), Error, 'throws an error when input shape is ' + shapes[i][0] + ' and output shape is ' + shapes[i][1] ); - } - t.end(); - - function scale( z ) { - return z * 10.0; - } - - function badValue( sh1, sh2 ) { - return function badValue() { - var dtype; - var ord; - var st1; - var st2; - var o1; - var o2; - var x; - var y; - - ord = 'row-major'; - dtype = 'float64'; - - st1 = shape2strides( sh1, ord ); - st2 = shape2strides( sh2, ord ); - o1 = strides2offset( sh1, st1 ); - o2 = strides2offset( sh2, st2 ); - - x = ndarray( dtype, ones( numel( sh1 ), dtype ), sh1, st1, o1, ord ); - y = ndarray( dtype, zeros( numel( sh2 ), dtype ), sh2, st2, o2, ord ); - - unary( [ x, y ], scale ); - }; - } -}); - -tape( 'the function throws an error if provided input and output ndarrays which do not have the same shape', function test( t ) { - var shapes; - var i; - - shapes = [ - [ [ 4, 2, 1 ], [ 4, 2, 2 ] ], - [ [ 3, 3 ], [ 2, 2 ] ], - [ [ 5, 5, 5 ], [ 5, 5, 4 ] ], - [ [ 1, 1, 1 ], [ 2, 2, 2 ] ], - [ [ 1, 4, 1, 2, 2 ], [ 3, 8 ] ], - [ [ 10, 2, 1 ], [ 1, 2, 10 ] ] - ]; - - for ( i = 0; i < shapes.length; i++ ) { - t.throws( badValue( shapes[i][0], shapes[i][1] ), Error, 'throws an error when input shape is ' + shapes[i][0] + ' and output shape is ' + shapes[i][1] ); - } - t.end(); - - function scale( z ) { - return z * 10.0; - } - - function badValue( sh1, sh2 ) { - return function badValue() { - var dtype; - var ord; - var st1; - var st2; - var o1; - var o2; - var x; - var y; - - ord = 'row-major'; - dtype = 'float64'; - - st1 = shape2strides( sh1, ord ); - st2 = shape2strides( sh2, ord ); - o1 = strides2offset( sh1, st1 ); - o2 = strides2offset( sh2, st2 ); - - x = ndarray( dtype, ones( numel( sh1 ), dtype ), sh1, st1, o1, ord ); - y = ndarray( dtype, zeros( numel( sh2 ), dtype ), sh2, st2, o2, ord ); - - unary( [ x, y ], scale ); - }; - } -}); diff --git a/test/test.nd.js b/test/test.nd.js deleted file mode 100644 index 8bf88b0..0000000 --- a/test/test.nd.js +++ /dev/null @@ -1,806 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var isSameComplex128Array = require( '@stdlib/assert-is-same-complex128array' ); -var isSameFloat64Array = require( '@stdlib/assert-is-same-float64array' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Float64Array = require( '@stdlib/array-float64' ); -var zeros = require( '@stdlib/array-zeros' ); -var oneTo = require( '@stdlib/array-one-to' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var real = require( '@stdlib/complex-float64-real' ); -var imag = require( '@stdlib/complex-float64-imag' ); -var ndarray = require( '@stdlib/ndarray-ctor' ); -var shape2strides = require( '@stdlib/ndarray-base-shape2strides' ); -var strides2offset = require( '@stdlib/ndarray-base-strides2offset' ); -var numel = require( '@stdlib/ndarray-base-numel' ); -var unary = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof unary, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, 16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 4, 2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 16, 16, -16, 16, -8, -4, -2, 1 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, contiguous)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( numel( sh ), dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset(sh, st); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape('the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'float64'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 1, 1, -1, -4, 8, -8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, oneTo( 16, dt ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Float64Array([ - 10.0, - 20.0, - 0.0, - 0.0, - 50.0, - 60.0, - 0.0, - 0.0, - 90.0, - 100.0, - 0.0, - 0.0, - 130.0, - 140.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return z * 10.0; - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 2, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 50.0, - 60.0, - 70.0, - 80.0, - 90.0, - 100.0, - 110.0, - 120.0, - 130.0, - 140.0, - 150.0, - 160.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -}); - -tape( 'the function applies a unary callback to each indexed element of an n-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { - var expected; - var ord; - var sh; - var st; - var dt; - var o; - var x; - var y; - - dt = 'complex128'; - ord = 'column-major'; - sh = [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, -1, 1, -1, 1, 1, -4, -8, 8 ]; - o = strides2offset( sh, st ); - - x = ndarray( dt, new Complex128Array( oneTo( numel( sh ) * 4, 'float64' ) ), sh, st, o, ord ); - y = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); - - unary( [ x, y ], scale ); - - expected = new Complex128Array([ - 10.0, - 20.0, - 30.0, - 40.0, - 0.0, - 0.0, - 0.0, - 0.0, - 90.0, - 100.0, - 110.0, - 120.0, - 0.0, - 0.0, - 0.0, - 0.0, - 170.0, - 180.0, - 190.0, - 200.0, - 0.0, - 0.0, - 0.0, - 0.0, - 250.0, - 260.0, - 270.0, - 280.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameComplex128Array( y.data, expected ), true, 'returns expected value' ); - t.end(); - - function scale( z ) { - return new Complex128( real(z)*10.0, imag(z)*10.0 ); - } -});